Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Core Modules
dune-common
Commits
e9450f8a
Commit
e9450f8a
authored
16 years ago
by
Oliver Sander
Browse files
Options
Downloads
Patches
Plain Diff
class FiniteStack has been moved to the header finitestack.hh for consistency.
[[Imported from SVN: r5193]]
parent
e283e98b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/finitestack.hh
+84
-0
84 additions, 0 deletions
common/finitestack.hh
common/stack.hh
+9
-62
9 additions, 62 deletions
common/stack.hh
with
93 additions
and
62 deletions
common/finitestack.hh
0 → 100644
+
84
−
0
View file @
e9450f8a
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_FINITE_STACK_HH
#define DUNE_FINITE_STACK_HH
#include
<dune/common/exceptions.hh>
namespace
Dune
{
/*! \addtogroup Common
@{
*/
/*! \file
This file implements a stack classes FiniteStack. It is
mainly used by the grid iterators where exact knowledge of the stack
implementation is needed to guarantee efficient execution.
*/
/** \brief A stack with static memory allocation
*
This class implements a very efficient stack where the maximum
depth is known in advance. Note that no error checking is
performed!
\param n Maximum number of stack entries
*/
template
<
class
T
,
int
n
>
class
FiniteStack
{
public:
//! Returns true if the stack is empty
bool
empty
()
const
{
return
f
==
0
;
}
//! Returns true if the stack is full
bool
full
()
const
{
return
f
>=
n
;
}
//! Puts a new object onto the stack
void
push
(
const
T
&
t
)
{
s
[
f
++
]
=
t
;
}
//! Removes and returns the uppermost object from the stack
T
pop
()
{
return
s
[
--
f
];
}
//! Returns the uppermost object on the stack
T
top
()
const
{
return
s
[
f
-
1
];
}
//! Dynamic stacksize
int
size
()
const
{
return
f
;
}
//! Makes empty stack
FiniteStack
()
{
f
=
0
;
}
private
:
T
s
[
n
];
int
f
;
};
}
//! }@
#endif
This diff is collapsed.
Click to expand it.
common/stack.hh
+
9
−
62
View file @
e9450f8a
...
...
@@ -7,6 +7,11 @@
#include
<dune/common/exceptions.hh>
#include
<dune/common/deprecated.hh>
// Backward compatibility
#include
<dune/common/finitestack.hh>
#warning This header is deprecated. Use std::stack instead of Dune::Stack. The class Dune::FiniteStack has been moved to finitestack.hh.
namespace
Dune
{
/*! \addtogroup Common
...
...
@@ -15,9 +20,11 @@ namespace Dune {
/*! \file
This file implements
two
stack-classes Stack
and FiniteStack. They are
This file implements
a
stack-classes Stack
. It is
mainly used by the grid iterators where exact knowledge of the stack
implementation is needed to guarantee efficient execution
implementation is needed to guarantee efficient execution.
\deprecated std::stack is several times faster than this class.
*/
//! Exception thrown by the stack
...
...
@@ -101,66 +108,6 @@ namespace Dune {
return
t
;
}
/** \brief A stack with static memory allocation
This class implements a very efficient stack where the maximum
depth is known in advance. Note that no error checking is
performed!
\param n Maximum number of stack entries
*/
template
<
class
T
,
int
n
>
class
FiniteStack
{
public:
//! Returns true if the stack is empty
bool
empty
()
const
{
return
f
==
0
;
}
//! Returns true if the stack is full
bool
full
()
const
{
return
f
>=
n
;
}
//! Puts a new object onto the stack
void
push
(
const
T
&
t
)
{
s
[
f
++
]
=
t
;
}
//! Removes and returns the uppermost object from the stack
T
pop
()
{
return
s
[
--
f
];
}
//! Returns the uppermost object on the stack
T
top
()
const
{
return
s
[
f
-
1
];
}
//! Dynamic stacksize
int
size
()
const
{
return
f
;
}
//! Makes empty stack
FiniteStack
()
{
f
=
0
;
}
private
:
T
s
[
n
];
int
f
;
};
}
//! }@
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment