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
f33e1854
Commit
f33e1854
authored
19 years ago
by
Christian Engwer
Browse files
Options
Downloads
Patches
Plain Diff
don't use Entity::index() anymore.
[[Imported from SVN: r2940]]
parent
a2c92160
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
grid/sgrid.hh
+51
-88
51 additions, 88 deletions
grid/sgrid.hh
grid/sgrid/sgrid.cc
+3
-18
3 additions, 18 deletions
grid/sgrid/sgrid.cc
with
54 additions
and
106 deletions
grid/sgrid.hh
+
51
−
88
View file @
f33e1854
...
...
@@ -248,11 +248,19 @@ namespace Dune {
public
:
typedef
typename
GridImp
::
template
Codim
<
codim
>
::
Geometry
Geometry
;
typedef
SMakeableGeometry
<
dim
-
codim
,
dimworld
,
const
GridImp
>
MakeableGeometry
;
typedef
sgrid_persistentindextype
PersistentIndexType
;
//! level of this element
int
level
()
const
;
int
level
()
const
{
return
l
;
}
//! index is unique and consecutive per level and codim used for access to degrees of freedom
int
index
()
const
;
int
index
()
const
{
return
compressedIndex
();
}
//! global index is calculated from the index and grid size
int
globalIndex
()
const
;
...
...
@@ -268,14 +276,28 @@ namespace Dune {
//! Reinitialization
void
make
(
int
_l
,
int
_id
);
//! globally unique, persistent index
PersistentIndexType
persistentIndex
()
const
{
PersistentIndexType
number1
(
compressedIndex
());
PersistentIndexType
number2
((
level
()
<<
4
)
+
codim
);
return
number1
|
(
number2
<<
52
);
}
//! consecutive, codim-wise, level-wise index
int
compressedIndex
()
const
{
return
id
;
}
protected
:
// this is how we implement our elements
GridImp
*
grid
;
//!< grid containes mapper, geometry, etc.
int
l
;
//!< level where element is on
int
id
;
//!< my consecutive id
FixedArray
<
int
,
dim
>
z
;
//!< my coordinate, number of even components = codim
GridImp
*
grid
;
//!< grid containes mapper, geometry, etc.
int
l
;
//!< level where element is on
int
id
;
//!< my consecutive id
FixedArray
<
int
,
dim
>
z
;
//!< my coordinate, number of even components = codim
mutable
MakeableGeometry
geo
;
//!< geometry, is only built on demand
mutable
bool
builtgeometry
;
//!< true if geometry has been constructed
mutable
bool
builtgeometry
;
//!< true if geometry has been constructed
};
...
...
@@ -296,7 +318,6 @@ namespace Dune {
typedef
typename
GridImp
::
template
Codim
<
0
>
::
IntersectionIterator
IntersectionIterator
;
typedef
typename
GridImp
::
template
Codim
<
0
>
::
HierarchicIterator
HierarchicIterator
;
// disambiguate member functions with the same name in both bases
//! level of this element
int
level
()
const
{
return
SEntityBase
<
codim
,
dim
,
GridImp
>::
level
();}
...
...
@@ -313,26 +334,6 @@ namespace Dune {
// specific to SEntity
//! constructor
SEntity
(
GridImp
*
_grid
,
int
_l
,
int
_id
)
:
SEntityBase
<
codim
,
dim
,
GridImp
>::
SEntityBase
(
_grid
,
_l
,
_id
)
{};
private
:
typedef
sgrid_persistentindextype
PersistentIndexType
;
friend
class
GridImp
::
LevelIndexSetType
;
// needs access to the private index methods
friend
class
GridImp
::
GlobalIdSetType
;
// needs access to the private index methods
//! globally unique, persistent index
PersistentIndexType
persistentIndex
()
const
{
PersistentIndexType
number1
(
SEntityBase
<
codim
,
dim
,
GridImp
>::
index
());
PersistentIndexType
number2
((
SEntityBase
<
codim
,
dim
,
GridImp
>::
level
()
<<
4
)
+
codim
);
return
number1
|
(
number2
<<
52
);
}
//! consecutive, codim-wise, level-wise index
int
compressedIndex
()
const
{
return
SEntityBase
<
codim
,
dim
,
GridImp
>::
index
();
}
};
/*!
...
...
@@ -369,6 +370,7 @@ namespace Dune {
typedef
typename
GridImp
::
template
Codim
<
0
>
::
EntityPointer
EntityPointer
;
typedef
typename
GridImp
::
template
Codim
<
0
>
::
IntersectionIterator
IntersectionIterator
;
typedef
typename
GridImp
::
template
Codim
<
0
>
::
HierarchicIterator
HierarchicIterator
;
typedef
sgrid_persistentindextype
PersistentIndexType
;
//! make HierarchicIterator a friend
friend
class
SHierarchicIterator
<
GridImp
>
;
...
...
@@ -399,6 +401,19 @@ namespace Dune {
//! return global index of entity<cc> number i
template
<
int
cc
>
int
subIndex
(
int
i
)
const
;
//! subentity compressed index
template
<
int
cc
>
int
subCompressedIndex
(
int
i
)
const
;
// is implemented in sgrid/sgrid.cc !
//! subentity persistent index
template
<
int
cc
>
PersistentIndexType
subPersistentIndex
(
int
i
)
const
{
PersistentIndexType
number1
(
this
->
template
subCompressedIndex
<
cc
>(
i
));
PersistentIndexType
number2
((
SEntityBase
<
0
,
dim
,
GridImp
>::
level
()
<<
4
)
+
cc
);
return
number1
|
(
number2
<<
52
);
}
/*! Intra-level access to intersections with neighboring elements.
A neighbor is an entity of codimension 0
which has an entity of codimension 1 in commen with this entity. Access to neighbors
...
...
@@ -465,39 +480,6 @@ namespace Dune {
}
private
:
typedef
sgrid_persistentindextype
PersistentIndexType
;
friend
class
GridImp
::
LevelIndexSetType
;
// needs access to the private index methods
friend
class
GridImp
::
GlobalIdSetType
;
// needs access to the private index methods
//! globally unique, persistent index
PersistentIndexType
persistentIndex
()
const
{
PersistentIndexType
number1
(
SEntityBase
<
0
,
dim
,
GridImp
>::
index
());
PersistentIndexType
number2
((
SEntityBase
<
0
,
dim
,
GridImp
>::
level
()
<<
4
));
return
number1
|
(
number2
<<
52
);
}
//! consecutive, codim-wise, level-wise index
int
compressedIndex
()
const
{
return
SEntityBase
<
0
,
dim
,
GridImp
>::
index
();
}
//! subentity compressed index
template
<
int
cc
>
int
subCompressedIndex
(
int
i
)
const
;
// is implemented in sgrid/sgrid.cc !
//! subentity persistent index
template
<
int
cc
>
PersistentIndexType
subPersistentIndex
(
int
i
)
const
{
PersistentIndexType
number1
(
this
->
template
subCompressedIndex
<
cc
>(
i
));
PersistentIndexType
number2
((
SEntityBase
<
0
,
dim
,
GridImp
>::
level
()
<<
4
)
+
cc
);
return
number1
|
(
number2
<<
52
);
}
mutable
bool
built_father
;
mutable
int
father_id
;
...
...
@@ -558,31 +540,6 @@ namespace Dune {
}
private
:
typedef
sgrid_persistentindextype
PersistentIndexType
;
friend
class
GridImp
::
LevelIndexSetType
;
// needs access to the private index methods
friend
class
GridImp
::
GlobalIdSetType
;
// needs access to the private index methods
//! globally unique, persistent index
PersistentIndexType
persistentIndex
()
const
{
PersistentIndexType
number1
(
SEntityBase
<
dim
,
dim
,
GridImp
>::
index
());
PersistentIndexType
number2
((
SEntityBase
<
dim
,
dim
,
GridImp
>::
level
()
<<
4
)
+
dim
);
return
number1
|
(
number2
<<
52
);
}
//! globally unique, persistent leaf index (only valid on leaves and copies)
PersistentIndexType
persistentLeafIndex
()
const
{
return
persistentIndex
();
}
//! consecutive, codim-wise, level-wise index
int
compressedIndex
()
const
{
return
SEntityBase
<
dim
,
dim
,
GridImp
>::
index
();
}
mutable
bool
built_father
;
mutable
int
father_id
;
mutable
FieldVector
<
sgrid_ctype
,
dim
>
in_father_local
;
...
...
@@ -1243,7 +1200,15 @@ namespace Dune {
// Index classes need access to the real entity
friend
class
Dune
::
SGridLevelIndexSet
<
Dune
::
SGrid
<
dim
,
dimworld
>
>
;
friend
class
Dune
::
SGridGlobalIdSet
<
Dune
::
SGrid
<
dim
,
dimworld
>
>
;
friend
class
Dune
::
SIntersectionIterator
<
Dune
::
SGrid
<
dim
,
dimworld
>
>
;
friend
class
Dune
::
SHierarchicIterator
<
Dune
::
SGrid
<
dim
,
dimworld
>
>
;
friend
class
Dune
::
SEntity
<
0
,
dim
,
Dune
::
SGrid
<
dim
,
dimworld
>
>
;
friend
class
Dune
::
SGridLevelIndexSet
<
const
Dune
::
SGrid
<
dim
,
dimworld
>
>
;
friend
class
Dune
::
SGridGlobalIdSet
<
const
Dune
::
SGrid
<
dim
,
dimworld
>
>
;
friend
class
Dune
::
SIntersectionIterator
<
const
Dune
::
SGrid
<
dim
,
dimworld
>
>
;
friend
class
Dune
::
SHierarchicIterator
<
const
Dune
::
SGrid
<
dim
,
dimworld
>
>
;
friend
class
Dune
::
SEntity
<
0
,
dim
,
const
Dune
::
SGrid
<
dim
,
dimworld
>
>
;
#if 1
template
<
int
codim
>
SEntity
<
codim
,
dim
,
const
SGrid
<
dim
,
dimworld
>
>&
getRealEntity
(
typename
Traits
::
template
Codim
<
codim
>
::
Entity
&
e
)
...
...
@@ -1274,8 +1239,6 @@ namespace Dune {
mutable
CubeMapper
<
dim
>
mapper
[
MAXL
];
// a mapper for each level
// faster implemantation od subIndex
friend
class
SEntity
<
0
,
dim
,
SGrid
<
dim
,
dimworld
>
>
;
friend
class
SEntity
<
0
,
dim
,
const
SGrid
<
dim
,
dimworld
>
>
;
mutable
FixedArray
<
int
,
dim
>
zrefStatic
;
// for subIndex of SEntity
mutable
FixedArray
<
int
,
dim
>
zentityStatic
;
// for subIndex of SEntity
};
...
...
This diff is collapsed.
Click to expand it.
grid/sgrid/sgrid.cc
+
3
−
18
View file @
f33e1854
...
...
@@ -254,21 +254,6 @@ namespace Dune {
builtgeometry
=
false
;
}
template
<
int
codim
,
int
dim
,
class
GridImp
>
inline
int
SEntityBase
<
codim
,
dim
,
GridImp
>::
level
()
const
{
return
l
;
}
// std::cout << i->index() << " " ;
// for (int z=0; z<N; ++z) std::cout << "["<<j[z]<<","<<A[z]<<"] ";
// std::cout << std::endl;
template
<
int
codim
,
int
dim
,
class
GridImp
>
inline
int
SEntityBase
<
codim
,
dim
,
GridImp
>::
index
()
const
{
return
id
;
}
template
<
int
codim
,
int
dim
,
class
GridImp
>
inline
int
SEntityBase
<
codim
,
dim
,
GridImp
>::
globalIndex
()
const
{
...
...
@@ -357,7 +342,7 @@ namespace Dune {
}
else
{
return
entity
<
cc
>
(
i
)
->
i
ndex
();
return
this
->
grid
->
template
getRealEntity
<
cc
>(
*
entity
<
cc
>
(
i
)).
compressedI
ndex
();
}
}
...
...
@@ -606,7 +591,7 @@ namespace Dune {
// remember element where begin has been called
orig_l
=
this
->
e
.
level
();
orig_id
=
this
->
e
.
index
();
orig_id
=
_grid
->
template
getRealEntity
<
0
>(
this
->
e
)
.
index
();
// push original element on stack
SHierarchicStackElem
originalElement
(
orig_l
,
orig_id
);
...
...
@@ -616,7 +601,7 @@ namespace Dune {
maxlevel
=
std
::
min
(
_maxlevel
,
this
->
grid
->
maxlevel
());
// ok, push all the sons as well
push_sons
(
this
->
e
.
level
(),
this
->
e
.
index
()
);
push_sons
(
orig_l
,
orig_id
);
// and pop the first son
increment
();
...
...
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