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
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Timo Koch
dune-common
Commits
260deaaf
Commit
260deaaf
authored
20 years ago
by
Robert Klöfkorn
Browse files
Options
Downloads
Patches
Plain Diff
Renamed tmpSize to additionalSizeEstimate.
[[Imported from SVN: r1700]]
parent
aeb3520a
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/common/defaultindexsets.hh
+2
-2
2 additions, 2 deletions
grid/common/defaultindexsets.hh
grid/common/leafindexset.hh
+53
-24
53 additions, 24 deletions
grid/common/leafindexset.hh
with
55 additions
and
26 deletions
grid/common/defaultindexsets.hh
+
2
−
2
View file @
260deaaf
...
...
@@ -28,7 +28,7 @@ namespace Dune {
{
public:
virtual
bool
compress
()
=
0
;
virtual
void
resize
()
=
0
;
virtual
void
resize
()
=
0
;
};
template
<
class
GridType
>
...
...
@@ -51,7 +51,7 @@ namespace Dune {
virtual
void
resize
()
{}
//! no extra memory for restriction is needed
int
tmpSiz
e
()
const
{
return
0
;
}
int
additionalSizeEstimat
e
()
const
{
return
0
;
}
//! all indices are old
bool
indexNew
(
int
num
,
int
codim
)
const
{
return
false
;
}
...
...
This diff is collapsed.
Click to expand it.
grid/common/leafindexset.hh
+
53
−
24
View file @
260deaaf
...
...
@@ -157,6 +157,8 @@ namespace Dune {
{
// create index set
resize
();
print
(
"LeafindexSet created !
\n\n
"
);
}
void
createFatherIndex
(
const
typename
GridType
::
template
codim
<
0
>
::
Entity
&
en
)
...
...
@@ -190,6 +192,8 @@ namespace Dune {
// give all entities that lie below the old entities new numbers
markAllBelowOld
();
print
(
"Resize of LeafIndexSet done
\n
"
);
}
//! for dof manager, to check whether it has to copy dof or not
...
...
@@ -209,12 +213,13 @@ namespace Dune {
bool
haveToCopy
=
false
;
// if not marked, mark which indices are still used
if
(
!
marked_
)
markAllUsed
();
if
(
!
marked_
)
actSize_
=
markAllUsed
();
// returns actual size of leaf level
// mark holes
actHole_
=
0
;
for
(
int
i
=
0
;
i
<
state_
.
size
();
i
++
)
{
// if index is not used but >=0 then its a hole
if
((
state_
[
i
]
==
UNUSED
)
&&
(
leafIndex_
[
i
]
>=
0
))
{
holes_
[
actHole_
]
=
leafIndex_
[
i
];
...
...
@@ -228,17 +233,25 @@ namespace Dune {
// close holes
for
(
int
i
=
0
;
i
<
leafIndex_
.
size
();
i
++
)
{
// a index that is used but larger then actual size
// has to move to a hole
if
(
state_
[
i
]
!=
UNUSED
)
{
// if used index lies behind size, then index has to move
// to one of the holes
if
(
leafIndex_
[
i
]
>=
actSize_
)
{
// serach next hole that is smaler than actual size
actHole_
--
;
// if actHole_ < 0 then error, because we have index larger then
// actual size
assert
(
actHole_
>=
0
);
while
(
holes_
[
actHole_
]
>=
actSize_
)
while
(
holes_
[
actHole_
]
>=
actSize_
)
{
actHole_
--
;
if
(
actHole_
<
0
)
break
;
}
assert
(
actHole_
>=
0
);
leafIndex_
[
i
]
=
holes_
[
actHole_
];
...
...
@@ -249,6 +262,7 @@ namespace Dune {
}
else
{
// all unsed indices are reset to -1
leafIndex_
[
i
]
=
-
1
;
}
}
...
...
@@ -259,6 +273,8 @@ namespace Dune {
// next turn mark again
marked_
=
false
;
print
(
"Done Compress
\n\n
"
);
return
haveToCopy
;
}
...
...
@@ -270,7 +286,7 @@ namespace Dune {
}
//! return how much extra memory is needed for restriction
int
tmpSiz
e
()
const
{
return
nextFreeIndex_
;
}
int
additionalSizeEstimat
e
()
const
{
return
nextFreeIndex_
;
}
//! return size of grid entities per level and codim
int
size
(
int
level
,
int
codim
)
const
...
...
@@ -372,25 +388,26 @@ namespace Dune {
//! mark indices that are still used and give new indices to
//! elements that need one
void
markAllUsed
()
int
markAllUsed
()
{
typedef
typename
GridType
::
LeafIterator
LeafIterator
;
for
(
int
i
=
0
;
i
<
state_
.
size
();
i
++
)
state_
[
i
]
=
UNUSED
;
// remember size
oldSize_
=
nextFreeIndex_
;
act
Size
_
=
0
;
int
n
Size
=
0
;
typedef
typename
GridType
::
LeafIterator
LeafIterator
;
// walk over leaf level on locate all needed entities
LeafIterator
endit
=
this
->
grid_
.
leafend
(
this
->
grid_
.
maxlevel
()
);
for
(
LeafIterator
it
=
this
->
grid_
.
leafbegin
(
this
->
grid_
.
maxlevel
()
);
it
!=
endit
;
++
it
)
{
this
->
insert
(
*
it
);
act
Size
_
++
;
n
Size
++
;
}
marked_
=
true
;
return
nSize
;
}
//! give all entities that lie below the old entities new numbers
...
...
@@ -433,25 +450,13 @@ namespace Dune {
}
// end grid walk trough
}
// end for all levels
marked_
=
true
;
// means on compress we have to mark the leaf level
marked_
=
false
;
}
// print interal data, for debugging only
void
print
(
bool
oldtoo
=
false
)
const
{
std
::
cout
<<
"Size "
<<
leafIndex_
.
size
()
<<
"
\n
"
;
std
::
cout
<<
"i | val | state
\n
"
;
int
actSize
=
0
;
for
(
int
i
=
0
;
i
<
leafIndex_
.
size
();
i
++
)
{
if
(
state_
[
i
]
!=
UNUSED
)
actSize
++
;
std
::
cout
<<
i
<<
" | "
<<
leafIndex_
[
i
]
<<
" | "
<<
state_
[
i
];
if
(
oldtoo
)
std
::
cout
<<
" | "
<<
oldLeafIndex_
[
i
];
std
::
cout
<<
"
\n
"
;
}
std
::
cout
<<
"Real Size "
<<
nextFreeIndex_
<<
"
\n
"
;
std
::
cout
<<
"ActSize "
<<
actSize
<<
"
\n
"
;
}
// print if only done, if DEBUG_LEAFINDEXSET is defined
void
print
(
const
char
*
msg
,
bool
oldtoo
=
false
)
const
;
public
:
...
...
@@ -526,6 +531,30 @@ namespace Dune {
};
// end of class AdaptiveLeafIndexSet
template
<
class
GridType
>
inline
void
AdaptiveLeafIndexSet
<
GridType
>::
print
(
const
char
*
msg
,
bool
oldtoo
)
const
{
#ifdef DEBUG_LEAFINDEXSET
std
::
cout
<<
"Size "
<<
leafIndex_
.
size
()
<<
"
\n
"
;
std
::
cout
<<
"i | val | state
\n
"
;
int
actSize
=
0
;
for
(
int
i
=
0
;
i
<
leafIndex_
.
size
();
i
++
)
{
if
(
state_
[
i
]
!=
UNUSED
)
actSize
++
;
std
::
cout
<<
i
<<
" | "
<<
leafIndex_
[
i
]
<<
" | "
<<
state_
[
i
];
std
::
cout
<<
"
\n
"
;
}
std
::
cout
<<
"Real Size "
<<
nextFreeIndex_
<<
"
\n
"
;
std
::
cout
<<
"ActSize "
<<
actSize
<<
"
\n
"
;
std
::
cout
<<
"Grid global Size "
<<
grid
.
global_size
(
0
)
<<
"
\n
"
;
std
::
cout
<<
msg
;
return
;
#endif
}
}
// end namespace Dune
#endif
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