3 #ifndef DUNE_ALBERTAGRID_IMP_HH 4 #define DUNE_ALBERTAGRID_IMP_HH 11 #if HAVE_ALBERTA || DOXYGEN 23 #include <dune/common/deprecated.hh> 24 #include <dune/common/fvector.hh> 25 #include <dune/common/fmatrix.hh> 26 #include <dune/common/stdstreams.hh> 27 #include <dune/common/parallel/collectivecommunication.hh> 64 template<
class Gr
id >
135 template<
int dim,
int dimworld = Alberta::dimWorld >
138 < dim, dimworld, Alberta::Real, AlbertaGridFamily< dim, dimworld > >
158 #if (__GNUC__ < 4) && !(defined __ICC) 166 template< class, class >
199 typedef typename Traits::template
Codim<0>::LeafIterator LeafIterator;
205 struct AdaptationState
207 enum Phase { ComputationPhase, PreAdaptationPhase, PostAdaptationPhase };
216 : phase_( ComputationPhase ),
221 void mark (
int count )
226 refineMarked_ += (2 << count);
229 void unmark (
int count )
234 refineMarked_ -= (2 << count);
237 bool coarsen ()
const 239 return (coarsenMarked_ > 0);
242 int refineMarked ()
const 244 return refineMarked_;
249 if( phase_ != ComputationPhase )
250 error(
"preAdapt may only be called in computation phase." );
251 phase_ = PreAdaptationPhase;
256 if( phase_ != PreAdaptationPhase )
257 error(
"adapt may only be called in preadapdation phase." );
258 phase_ = PostAdaptationPhase;
263 if( phase_ != PostAdaptationPhase )
264 error(
"postAdapt may only be called in postadaptation phase." );
265 phase_ = ComputationPhase;
272 void error (
const std::string &message )
274 DUNE_THROW( InvalidStateException, message );
278 template<
class DataHandler >
279 struct AdaptationCallback;
282 static const int MAXL = 64;
291 This &
operator= (
const This & ) =
delete;
305 template<
class Proj,
class Impl >
313 AlbertaGrid (
const std::string ¯oGridFileName );
323 template<
int cd, PartitionIteratorType pitype>
328 template<
int cd, PartitionIteratorType pitype>
330 lend (
int level)
const;
333 template<
int codim >
335 lbegin (
int level )
const;
338 template<
int codim >
340 lend (
int level )
const;
343 template<
int codim, PartitionIteratorType pitype >
349 template<
int codim, PartitionIteratorType pitype >
355 template<
int codim >
360 template<
int codim >
368 int size (
int level,
int codim)
const;
374 int size (
int codim)
const;
382 return numBoundarySegments_;
389 typedef typename View::GridViewImp ViewImp;
390 return View( ViewImp( *
this, level ) );
397 typedef typename View::GridViewImp ViewImp;
398 return View( ViewImp( *
this ) );
417 template<
class DataHandle >
424 template<
class DataHandle >
442 std::ostringstream s;
443 s <<
"AlbertaGrid< " << dim <<
", " << dimworld <<
" >";
448 template<
class EntitySeed >
499 return dofNumbering_;
504 return levelProvider_;
509 return numberingMap_.dune2alberta( codim, i );
514 return numberingMap_.alberta2dune( codim, i );
519 return genericNumberingMap_.dune2alberta( codim, i );
524 return genericNumberingMap_.alberta2dune( codim, i );
529 DUNE_DEPRECATED_MSG(
"Deprecated in Dune 3.0, use writeGrid instead.")
534 DUNE_DEPRECATED_MSG(
"Deprecated in Dune 3.0, use readGrid instead.")
540 typedef std::vector<int> ArrayType;
561 template<
int codim >
568 template<
int codim >
609 size_t numBoundarySegments_;
615 DofNumbering dofNumbering_;
617 LevelProvider levelProvider_;
627 mutable std::vector< typename GridFamily::LevelIndexSetImp * > levelIndexVec_;
638 mutable MarkerVector leafMarkerVector_;
641 mutable std::vector< MarkerVector > levelMarkerVector_;
643 #if DUNE_ALBERTA_CACHE_COORDINATES 648 AdaptationState adaptationState_;
659 #ifdef _ABS_NOT_DEFINED_ 663 #ifdef _MIN_NOT_DEFINED_ 667 #ifdef _MAX_NOT_DEFINED_ 671 #ifdef obstack_chunk_alloc 672 #undef obstack_chunk_alloc 674 #ifdef obstack_chunk_free 675 #undef obstack_chunk_free 694 #endif // #ifdef ERROR 699 #endif // #ifdef ERROR_EXIT 704 #endif // #ifdef WARNING 709 #endif // #ifdef TEST 714 #endif // #ifdef TEST_EXIT 719 #endif // #ifdef DEBUG_TEST 722 #ifdef DEBUG_TEST_EXIT 723 #undef DEBUG_TEST_EXIT 724 #endif // #ifdef DEBUG_TEST_EXIT 729 #endif // #ifdef INFO 734 #endif // #ifdef PRINT_INFO 739 #endif // #ifdef PRINT_INT_VEC 742 #ifdef PRINT_REAL_VEC 743 #undef PRINT_REAL_VEC 744 #endif // #ifdef PRINT_REAL_VEC 749 #endif // #ifdef WAIT 754 #endif // #ifdef WAIT_REALLY 759 #endif // #ifdef GET_WORKSPACE 762 #ifdef FREE_WORKSPACE 763 #undef FREE_WORKSPACE 764 #endif // #ifdef FREE_WORKSPACE 769 #endif // #ifdef MAT_ALLOC 774 #endif // #ifdef MAT_FREE 779 #endif // #ifdef NAME 784 #endif // #ifdef GET_STRUCT 789 #endif // #ifdef ADD_PARAMETER 794 #endif // #ifdef GET_PARAMETER 798 #endif // HAVE_ALBERTA || DOXYGEN #define ALBERTA
Definition: albertaheader.hh:27
static int getTwistInInside(const typename Traits::LeafIntersection &intersection)
Definition: agrid.hh:576
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: albertagrid.cc:204
bool writeGridXdr(const std::string &filename, ctype time) const
Definition: albertagrid.cc:573
Implementation of the IntersectionIterator for AlbertaGrid.
Traits::template Codim< EntitySeed::codimension >::Entity entity(const EntitySeed &seed) const
obtain Entity from EntitySeed.
Definition: agrid.hh:450
const DofNumbering & dofNumbering() const
Definition: agrid.hh:497
Definition: albertagrid/gridfamily.hh:50
Definition: albertagrid/entity.hh:27
Index Set Interface base class.
Definition: common/grid.hh:346
Definition: albertagrid/gridview.hh:20
bool readGridXdr(const std::string &filename, ctype &time)
reads ALBERTA mesh file
Definition: albertagrid.cc:581
marker assigning subentities to one element containing them
Definition: treeiterator.hh:31
Interface class for vertex projection at the boundary.
Definition: boundaryprojection.hh:23
int dune2alberta(int codim, int i) const
Definition: agrid.hh:507
Definition: albertagrid/projection.hh:77
bool mark(int refCount, const typename Traits::template Codim< 0 >::Entity &e)
Marks an entity to be refined/coarsened in a subsequent adapt.
Definition: albertagrid.cc:383
int generic2alberta(int codim, int i) const
Definition: agrid.hh:517
Definition: albertagrid/gridfamily.hh:80
Interface class for the Grid's adapt method where the parameter is a AdaptDataHandleInterface.
Definition: adaptcallback.hh:30
[ provides Dune::Grid ]
Definition: agrid.hh:136
interfaces and wrappers needed for the callback adaptation provided by AlbertaGrid and dune-ALUGrid ...
static int getTwist(const typename Traits::template Codim< codim >::Entity &entity)
Definition: agrid.hh:563
Traits::LeafGridView leafGridView() const
View for the leaf grid for All_Partition.
Definition: agrid.hh:394
AlbertaGrid()
create an empty grid
Definition: albertagrid.cc:40
static const int dimensionworld
Definition: agrid.hh:176
const CollectiveCommunication & comm() const
return reference to collective communication, if MPI found this is specialisation for MPI ...
Definition: agrid.hh:435
Id Set Interface.
Definition: common/grid.hh:347
Contains #undefs for all preprocessor macros defined by alberta.
Definition: albertagrid/gridfamily.hh:65
Definition: albertagrid/entity.hh:42
Definition: albertagrid/datahandle.hh:24
bool adapt()
Refine all positive marked leaf entities, coarsen all negative marked entities if possible...
Definition: albertagrid.cc:413
Provide a generic factory class for unstructured grids.
Definition: common/gridfactory.hh:263
Definition: albertagrid/entity.hh:24
Definition: coordcache.hh:22
ALBERTA REAL Real
Definition: misc.hh:46
Definition: common/grid.hh:1171
const LocalIdSet & localIdSet() const
return local IdSet
Definition: agrid.hh:481
Alberta::Real ctype
Definition: albertagrid/gridfamily.hh:84
const HierarchicIndexSet & hierarchicIndexSet() const
Definition: agrid.hh:466
static const int dimensionworld
Definition: albertagrid/gridfamily.hh:87
int alberta2dune(int codim, int i) const
Definition: agrid.hh:512
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
static std::conditional< std::is_reference< InterfaceType >::value, typename std::add_lvalue_reference< typename ReturnImplementationType< typename std::remove_reference< InterfaceType >::type >::ImplementationType >::type, typename std::remove_const< typename ReturnImplementationType< typename std::remove_reference< InterfaceType >::type >::ImplementationType >::type >::type getRealImplementation(InterfaceType &&i)
return real implementation of interface class
Definition: common/grid.hh:1026
Traits::CollectiveCommunication CollectiveCommunication
type of collective communication
Definition: agrid.hh:195
static int getTwist(const typename Traits::template Codim< 0 >::Entity &entity, int subEntity)
Definition: agrid.hh:570
const AlbertaGridLeafIntersection< const This > & getRealIntersection(const typename Traits::LeafIntersection &intersection) const
Definition: agrid.hh:588
Store a reference to an entity with a minimal memory footprint.
Definition: common/entityseed.hh:23
hierarchic index set of AlbertaGrid
Definition: albertagrid/gridfamily.hh:62
Definition: albertagrid/entity.hh:30
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator lend(int level) const
one past the end on this level
Definition: albertagrid.cc:224
~AlbertaGrid()
desctructor
Definition: albertagrid.cc:194
Provides size cache classes to implement the grids size method efficiently.
static const int dimension
Definition: albertagrid/gridfamily.hh:86
bool readGrid(const std::string &filename, ctype &time)
read Grid from file filename and store time of mesh in time
Definition: albertagrid.cc:599
Definition: albertagrid/entity.hh:21
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
returns adaptation mark for given entity
Definition: albertagrid.cc:406
int size(int level, int codim) const
Number of grid entities per level and codim because lbegin and lend are none const, and we need this methods counting the entities on each level, you know.
Definition: albertagrid.cc:488
Traits ::template Codim< codim >::template Partition< pitype >::LeafIterator leafend() const
return LeafIterator which points behind last leaf entity
std::size_t numBoundarySegments() const
number of boundary segments within the macro grid
Definition: agrid.hh:380
const Traits ::LevelIndexSet & levelIndexSet(int level) const
return level index set for given level
Definition: albertagrid.cc:518
provides the GridFamily for AlbertaGrid
Definition: albertagrid/gridfamily.hh:95
const Alberta::GlobalVector & getCoord(const ElementInfo &elementInfo, int vertex) const
Definition: albertagrid.cc:469
IndexSet< GridImp, LevelIndexSetImp, int, std::array< GeometryType, 1 > > LevelIndexSet
Definition: albertagrid/gridfamily.hh:140
Definition: albertagrid/intersection.hh:29
Definition: common/geometry.hh:24
Intersection of a mesh entity of codimension 0 ("element") with a "neighboring" element or with the d...
Definition: albertagrid/dgfparser.hh:26
void globalRefine(int refCount)
uses the interface, mark on entity and refineLocal
Definition: albertagrid.cc:302
static const int dimension
Definition: agrid.hh:175
Traits ::template Codim< codim >::template Partition< pitype >::LeafIterator leafbegin() const
return LeafIterator which points to first leaf entity
int maxLevel() const
Definition: albertagrid.cc:481
Grid view abstract base class.
Definition: common/gridview.hh:59
Provide a generic factory class for unstructured grids.
ALBERTA REAL_D GlobalVector
Definition: misc.hh:48
ALBERTA MESH * getMesh() const
Definition: agrid.hh:487
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
returns adaptation mark for given entity, i.e. here the default implementation returns 0...
Definition: common/grid.hh:920
const Traits ::LeafIndexSet & leafIndexSet() const
return leaf index set
Definition: albertagrid.cc:533
Traits::LevelGridView levelGridView(int level) const
View for a grid level for All_Partition.
Definition: agrid.hh:386
This & operator=(const This &)=delete
void postAdapt()
clean up some markers
Definition: albertagrid.cc:354
static int getTwistInOutside(const typename Traits::LeafIntersection &intersection)
Definition: agrid.hh:582
const GlobalIdSet & globalIdSet() const
return global IdSet
Definition: agrid.hh:475
Definition: common.hh:179
Different resources needed by all grid implementations.
bool preAdapt()
returns true, if a least one element is marked for coarsening
Definition: albertagrid.cc:346
Dune::CollectiveCommunication< No_Comm > CollectiveCommunication
Definition: albertagrid/gridfamily.hh:146
Definition: albertagrid/gridview.hh:23
const LevelProvider & levelProvider() const
Definition: agrid.hh:502
organizes the caching of sizes for one grid and one GeometryType
Definition: sizecache.hh:30
static std::string typeName()
Definition: agrid.hh:440
int alberta2generic(int codim, int i) const
Definition: agrid.hh:522
IndexSet< GridImp, LeafIndexSetImp, int, std::array< GeometryType, 1 > > LeafIndexSet
Definition: albertagrid/gridfamily.hh:141
bool mark(int refCount, const typename Traits ::template Codim< 0 >::Entity &e)
Marks an entity to be refined/coarsened in a subsequent adapt.
Definition: common/grid.hh:908
const MeshPointer & meshPointer() const
Definition: agrid.hh:492
A Traits struct that collects all associated types of one implementation.
Definition: common/grid.hh:414
GridFamily::ctype ctype
Definition: agrid.hh:173
Include standard header files.
Definition: agrid.hh:58
bool writeGrid(const std::string &filename, ctype time) const
write Grid to file in Xdr
Definition: albertagrid.cc:589