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
6c4c8552
Commit
6c4c8552
authored
19 years ago
by
Oliver Sander
Browse files
Options
Downloads
Patches
Plain Diff
bugfix
[[Imported from SVN: r2420]]
parent
31103118
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
grid/uggrid.hh
+258
-262
258 additions, 262 deletions
grid/uggrid.hh
with
258 additions
and
262 deletions
grid/uggrid.hh
+
258
−
262
View file @
6c4c8552
...
...
@@ -205,279 +205,275 @@ namespace Dune {
//! one past the end on this level
template
<
int
codim
,
PartitionIteratorType
PiType
>
typename
Traits
::
template
Codim
<
codim
>
::
template
Partition
<
PiType
>
::
LeafIterator
leafend
()
const
{
typename
Traits
::
template
Codim
<
codim
>
::
template
partition
<
PiType
>
::
LeafIterator
leafend
()
const
{
DUNE_THROW
(
NotImplemented
,
"leafend not implemented"
);
}
/** \brief Number of grid entities per level and codim
*/
int
size
(
int
level
,
int
codim
)
const
;
//! number of leaf entities per codim in this process
int
size
(
int
codim
)
const
{
DUNE_THROW
(
NotImplemented
,
"not implemented"
);
return
0
;
}
//! number of entities per level, codim and geometry type in this process
int
size
(
int
level
,
int
codim
,
GeometryType
type
)
const
{
DUNE_THROW
(
NotImplemented
,
"not implemented"
);
return
0
;
}
//! number of leaf entities per codim and geometry type in this process
int
size
(
int
codim
,
GeometryType
type
)
const
{
DUNE_THROW
(
NotImplemented
,
"not implemented"
);
return
0
;
}
const
GlobalIdSet
&
globalidset
()
const
{
return
globalIdSet_
;
}
const
LocalIdSet
&
localidset
()
const
{
return
localIdSet_
;
}
const
LevelIndexSet
&
levelindexset
(
int
level
)
const
{
return
levelIndexSets_
[
level
];
}
const
LeafIndexSet
&
leafindexset
()
const
{
return
leafIndexSet_
;
}
/** \brief Mark entity for refinement
*
* This only works for entities of codim 0.
* The parameter is currently ignored
*
* \return <ul>
* <li> true, if element was marked </li>
* <li> false, if nothing changed </li>
* </ul>
*/
bool
mark
(
int
refCount
,
typename
Traits
::
template
Codim
<
0
>
::
EntityPointer
&
e
);
/** \brief Mark method accepting a UG refinement rule
*/
DUNE_THROW
(
NotImplemented
,
"leafend not implemented"
);
}
/** \brief Number of grid entities per level and codim
*/
int
size
(
int
level
,
int
codim
)
const
;
//! number of leaf entities per codim in this process
int
size
(
int
codim
)
const
{
DUNE_THROW
(
NotImplemented
,
"not implemented"
);
return
0
;
}
//! number of entities per level, codim and geometry type in this process
int
size
(
int
level
,
int
codim
,
GeometryType
type
)
const
{
DUNE_THROW
(
NotImplemented
,
"not implemented"
);
return
0
;
}
//! number of leaf entities per codim and geometry type in this process
int
size
(
int
codim
,
GeometryType
type
)
const
{
DUNE_THROW
(
NotImplemented
,
"not implemented"
);
return
0
;
}
const
GlobalIdSet
&
globalidset
()
const
{
return
globalIdSet_
;
}
const
LocalIdSet
&
localidset
()
const
{
return
localIdSet_
;
}
const
LevelIndexSet
&
levelindexset
(
int
level
)
const
{
return
levelIndexSets_
[
level
];
}
const
LeafIndexSet
&
leafindexset
()
const
{
return
leafIndexSet_
;
}
/** \brief Mark entity for refinement
*
* This only works for entities of codim 0.
* The parameter is currently ignored
*
* \return <ul>
* <li> true, if element was marked </li>
* <li> false, if nothing changed </li>
* </ul>
*/
bool
mark
(
int
refCount
,
typename
Traits
::
template
Codim
<
0
>
::
EntityPointer
&
e
);
/** \brief Mark method accepting a UG refinement rule
*/
#ifdef _3
bool
mark
(
typename
Traits
::
template
Codim
<
0
>
::
EntityPointer
&
e
,
UG3d
::
RefinementRule
rule
);
bool
mark
(
typename
Traits
::
template
Codim
<
0
>
::
EntityPointer
&
e
,
UG3d
::
RefinementRule
rule
);
#else
bool
mark
(
typename
Traits
::
template
Codim
<
0
>
::
EntityPointer
&
e
,
UG2d
::
RefinementRule
rule
);
bool
mark
(
typename
Traits
::
template
Codim
<
0
>
::
EntityPointer
&
e
,
UG2d
::
RefinementRule
rule
);
#endif
//! Triggers the grid refinement process
bool
adapt
();
/** \brief Clean up refinement markers */
void
postAdapt
();
/** \brief Please doc me! */
GridIdentifier
type
()
const
{
return
UGGrid_Id
;
};
/** \brief Distributes this grid over the available nodes in a distributed machine
*
\param minlevel The coarsest grid level that gets distributed
\param maxlevel does currently get ignored
*/
void
loadBalance
(
int
strategy
,
int
minlevel
,
int
depth
,
int
maxlevel
,
int
minelement
);
/** \brief The communication interface
@param T: array class holding data associated with the entities
@param P: type used to gather/scatter data in and out of the message buffer
@param codim: communicate entites of given codim
@param if: one of the predifined interface types, throws error if it is not implemented
@param level: communicate for entities on the given level
Implements a generic communication function sending an object of type P for each entity
in the intersection of two processors. P has two methods gather and scatter that implement
the protocol. Therefore P is called the "protocol class".
*/
template
<
class
T
,
template
<
class
>
class
P
,
int
codim
>
void
communicate
(
T
&
t
,
InterfaceType
iftype
,
CommunicationDirection
dir
,
int
level
);
// **********************************************************
// End of Interface Methods
// **********************************************************
/** \brief Start the coarse grid creation process */
void
createbegin
();
/** \brief End the coarse grid creation process */
void
createend
();
/** \brief Adapt the grid without constructing the green closure
WARNING: This is a very special method. Omitting the green closure does
not mean that UG creates correct nonconforming meshes. For internal
reasons (bugs?) though, it allows you to do uniform refinement with
a few anisotropic refinement rules such as UG3d::PRISM_QUADSECT or
UG3d::HEX_QUADSECT_0.
*/
void
adaptWithoutClosure
();
/** \brief Rudimentary substitute for a hierarchic iterator on faces
\param e, elementSide Grid face specified by an element and one of its sides
\param maxl The finest level that should be traversed by the iterator
\param children For each subface: element index, elementSide, and level
*/
void
getChildrenOfSubface
(
typename
Traits
::
template
Codim
<
0
>
::
EntityPointer
&
e
,
int
elementSide
,
int
maxl
,
Array
<
typename
Dune
::
UGGridEntityPointer
<
0
,
UGGrid
>
>&
childElements
,
Array
<
unsigned
char
>&
childElementSides
)
const
;
/** \brief The different forms of grid refinement that UG supports */
enum
RefinementType
{
/** \brief New level consists only of the refined elements */
LOCAL
,
/** \brief New level consists of the refined elements and the unrefined ones, too */
COPY
};
/** \brief Sets the type of grid refinement */
void
setRefinementType
(
RefinementType
type
)
{
refinementType_
=
type
;
}
/** \brief Collapses the grid hierarchy into a single grid */
void
collapse
()
{
if
(
Collapse
(
multigrid_
))
DUNE_THROW
(
GridError
,
"UG"
<<
dim
<<
"d::Collapse() returned error code!"
);
}
/** \brief Read access to the UG-internal grid name */
const
std
::
string
&
name
()
const
{
return
name_
;}
/** \brief Calls a few interal methods to properly set up a UG grid */
void
makeNewUGMultigrid
();
/** \brief Does uniform refinement
*
* \param n Number of uniform refinement steps
*/
void
globalRefine
(
int
n
);
// UG multigrid, which contains the data
typename
UGTypes
<
dimworld
>::
MultiGridType
*
multigrid_
;
public
:
// I need this to store some information that gets passed
// to the boundary description
void
*
extra_boundary_data_
;
private
:
// Access to entity implementations through the interface wrappers
template
<
int
cd
>
UGGridEntity
<
cd
,
dim
,
const
UGGrid
>&
getRealEntity
(
typename
Traits
::
template
Codim
<
cd
>
::
Entity
&
entity
)
{
return
entity
.
realEntity
;
}
// Const access to entity implementations through the interface wrappers
template
<
int
cd
>
const
UGGridEntity
<
cd
,
dim
,
const
UGGrid
>&
getRealEntity
(
const
typename
Traits
::
template
Codim
<
cd
>
::
Entity
&
entity
)
const
{
return
entity
.
realEntity
;
}
// Start up the UG system
void
init
(
unsigned
int
heapSize
,
unsigned
int
envHeapSize
);
// Recomputes entity indices after the grid was changed
void
setLocalIndices
();
// Each UGGrid object has a unique name to identify it in the
// UG environment structure
std
::
string
name_
;
// Our set of level indices
std
::
vector
<
LevelIndexSet
>
levelIndexSets_
;
LeafIndexSet
leafIndexSet_
;
GlobalIdSet
globalIdSet_
;
LocalIdSet
localIdSet_
;
//! Marks whether the UG environment heap size is taken from
//! an existing defaults file or whether the values from
//! the UGGrid constructor are taken
static
bool
useExistingDefaultsFile
;
//! The type of grid refinement currently in use
RefinementType
refinementType_
;
//!
bool
omitGreenClosure_
;
/** \brief Number of UGGrids currently in use.
*
* This counts the number of UGGrids currently instantiated. All
* constructors of UGGrid look at this variable. If it zero, they
* initialize UG before proceeding. Destructors use the same mechanism
* to safely shut down UG after deleting the last UGGrid object.
*/
static
int
numOfUGGrids
;
/** \brief The arguments to UG's newformat command
*
* They need to be allocated dynamically, because UG writes into
* some of them. That causes the code to crash if it has been
* compiled with gcc.
*/
char
*
newformatArgs
[
4
];
/** \brief The size of UG's internal heap in megabytes
*
* It is handed over to UG for each new multigrid. I don't know
* what happens if you hand over differing values.
*/
unsigned
int
heapsize
;
//! Triggers the grid refinement process
bool
adapt
();
/** \brief Clean up refinement markers */
void
postAdapt
();
};
// end Class UGGrid
/** \brief Please doc me! */
GridIdentifier
type
()
const
{
return
UGGrid_Id
;
};
namespace
Capabilities
{
/** \brief Distributes this grid over the available nodes in a distributed machine
*
\param minlevel The coarsest grid level that gets distributed
\param maxlevel does currently get ignored
*/
void
loadBalance
(
int
strategy
,
int
minlevel
,
int
depth
,
int
maxlevel
,
int
minelement
);
/** \brief The communication interface
@param T: array class holding data associated with the entities
@param P: type used to gather/scatter data in and out of the message buffer
@param codim: communicate entites of given codim
@param if: one of the predifined interface types, throws error if it is not implemented
@param level: communicate for entities on the given level
Implements a generic communication function sending an object of type P for each entity
in the intersection of two processors. P has two methods gather and scatter that implement
the protocol. Therefore P is called the "protocol class".
*/
template
<
class
T
,
template
<
class
>
class
P
,
int
codim
>
void
communicate
(
T
&
t
,
InterfaceType
iftype
,
CommunicationDirection
dir
,
int
level
);
// **********************************************************
// End of Interface Methods
// **********************************************************
/** \brief Start the coarse grid creation process */
void
createbegin
();
/** \brief End the coarse grid creation process */
void
createend
();
/** \brief Adapt the grid without constructing the green closure
WARNING: This is a very special method. Omitting the green closure does
not mean that UG creates correct nonconforming meshes. For internal
reasons (bugs?) though, it allows you to do uniform refinement with
a few anisotropic refinement rules such as UG3d::PRISM_QUADSECT or
UG3d::HEX_QUADSECT_0.
*/
void
adaptWithoutClosure
();
/** \brief Rudimentary substitute for a hierarchic iterator on faces
\param e, elementSide Grid face specified by an element and one of its sides
\param maxl The finest level that should be traversed by the iterator
\param children For each subface: element index, elementSide, and level
*/
void
getChildrenOfSubface
(
typename
Traits
::
template
Codim
<
0
>
::
EntityPointer
&
e
,
int
elementSide
,
int
maxl
,
Array
<
typename
Dune
::
UGGridEntityPointer
<
0
,
UGGrid
>
>&
childElements
,
Array
<
unsigned
char
>&
childElementSides
)
const
;
/** \brief The different forms of grid refinement that UG supports */
enum
RefinementType
{
/** \brief New level consists only of the refined elements */
LOCAL
,
/** \brief New level consists of the refined elements and the unrefined ones, too */
COPY
};
/** \brief Sets the type of grid refinement */
void
setRefinementType
(
RefinementType
type
)
{
refinementType_
=
type
;
}
/** \brief Collapses the grid hierarchy into a single grid */
void
collapse
()
{
if
(
Collapse
(
multigrid_
))
DUNE_THROW
(
GridError
,
"UG"
<<
dim
<<
"d::Collapse() returned error code!"
);
}
/** \brief Read access to the UG-internal grid name */
const
std
::
string
&
name
()
const
{
return
name_
;}
/** \brief Calls a few interal methods to properly set up a UG grid */
void
makeNewUGMultigrid
();
/** \brief Does uniform refinement
*
* \param n Number of uniform refinement steps
*/
void
globalRefine
(
int
n
);
// UG multigrid, which contains the data
typename
UGTypes
<
dimworld
>::
MultiGridType
*
multigrid_
;
public
:
// I need this to store some information that gets passed
// to the boundary description
void
*
extra_boundary_data_
;
template
<
int
dim
,
int
dimw
>
struct
hasLeafIterator
<
UGGrid
<
dim
,
dimw
>
>
{
static
const
bool
v
=
true
;
};
template
<
int
dim
,
int
dimw
>
struct
hasEntity
<
UGGrid
<
dim
,
dimw
>
,
0
>
{
static
const
bool
v
=
true
;
};
template
<
int
dim
,
int
dimw
>
struct
hasEntity
<
UGGrid
<
dim
,
dimw
>
,
dim
>
{
static
const
bool
v
=
true
;
};
template
<
int
dim
,
int
dimw
>
struct
isParallel
<
UGGrid
<
dim
,
dimw
>
>
{
static
const
bool
v
=
true
;
};
private
:
// Access to entity implementations through the interface wrappers
template
<
int
cd
>
UGGridEntity
<
cd
,
dim
,
const
UGGrid
>&
getRealEntity
(
typename
Traits
::
template
Codim
<
cd
>
::
Entity
&
entity
)
{
return
entity
.
realEntity
;
}
}
// namespace Dune
// Const access to entity implementations through the interface wrappers
template
<
int
cd
>
const
UGGridEntity
<
cd
,
dim
,
const
UGGrid
>&
getRealEntity
(
const
typename
Traits
::
template
Codim
<
cd
>
::
Entity
&
entity
)
const
{
return
entity
.
realEntity
;
}
// Start up the UG system
void
init
(
unsigned
int
heapSize
,
unsigned
int
envHeapSize
);
// Recomputes entity indices after the grid was changed
void
setLocalIndices
();
// Each UGGrid object has a unique name to identify it in the
// UG environment structure
std
::
string
name_
;
// Our set of level indices
std
::
vector
<
LevelIndexSet
>
levelIndexSets_
;
LeafIndexSet
leafIndexSet_
;
GlobalIdSet
globalIdSet_
;
LocalIdSet
localIdSet_
;
//! Marks whether the UG environment heap size is taken from
//! an existing defaults file or whether the values from
//! the UGGrid constructor are taken
static
bool
useExistingDefaultsFile
;
//! The type of grid refinement currently in use
RefinementType
refinementType_
;
//!
bool
omitGreenClosure_
;
/** \brief Number of UGGrids currently in use.
*
* This counts the number of UGGrids currently instantiated. All
* constructors of UGGrid look at this variable. If it zero, they
* initialize UG before proceeding. Destructors use the same mechanism
* to safely shut down UG after deleting the last UGGrid object.
*/
static
int
numOfUGGrids
;
/** \brief The arguments to UG's newformat command
*
* They need to be allocated dynamically, because UG writes into
* some of them. That causes the code to crash if it has been
* compiled with gcc.
*/
char
*
newformatArgs
[
4
];
/** \brief The size of UG's internal heap in megabytes
*
* It is handed over to UG for each new multigrid. I don't know
* what happens if you hand over differing values.
*/
unsigned
int
heapsize
;
};
// end Class UGGrid
namespace
Capabilities
{
template
<
int
dim
,
int
dimw
>
struct
hasLeafIterator
<
UGGrid
<
dim
,
dimw
>
>
{
static
const
bool
v
=
true
;
};
template
<
int
dim
,
int
dimw
>
struct
hasEntity
<
UGGrid
<
dim
,
dimw
>
,
0
>
{
static
const
bool
v
=
true
;
};
template
<
int
dim
,
int
dimw
>
struct
hasEntity
<
UGGrid
<
dim
,
dimw
>
,
dim
>
{
static
const
bool
v
=
true
;
};
template
<
int
dim
,
int
dimw
>
struct
isParallel
<
UGGrid
<
dim
,
dimw
>
>
{
static
const
bool
v
=
true
;
};
}
// Include the method definitions
//#include "uggrid/uggrid.cc"
}
// 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