Skip to content
Snippets Groups Projects
Commit 0846b2d5 authored by Oliver Sander's avatar Oliver Sander
Browse files

The UGGrid implementation now offers three different forms of grid

refinement:
- LOCAL: Local grid refinement as you would expect it
- COPY: As local, but unrefined elements are copied along to the next
        level.  That way each level completely covers the computational
	domain.
- COLLAPSE: After refinement, the grid is collapsed into one single
        grid level.

You can change the refinement mode at any time using the methode
setRefinementType().

[[Imported from SVN: r1216]]
parent 70ae9d15
No related branches found
No related tags found
No related merge requests found
......@@ -126,17 +126,8 @@ namespace Dune {
{
friend class UGGridEntity <0,dim,dimworld>;
//friend class UGGridEntity <1,dim,dimworld>;
//friend class UGGridEntity <1 << dim-1 ,dim,dimworld>;
friend class UGGridEntity <dim,dim,dimworld>;
// friends because of fillElInfo
// friend class UGGridLevelIterator<0,dim,dimworld>;
// friend class UGGridLevelIterator<1,dim,dimworld>;
// friend class UGGridLevelIterator<2,dim,dimworld>;
// friend class UGGridLevelIterator<3,dim,dimworld>;
friend class UGGridHierarchicIterator<dim,dimworld>;
friend class UGGridIntersectionIterator<dim,dimworld>;
......@@ -162,9 +153,6 @@ namespace Dune {
* \todo Replace this by a true leaf iterator */
typedef UGGridLevelIterator<0,dim,dimworld, All_Partition> LeafIterator;
/** \todo Please doc me! */
// enum { numCodim = dim+1 };
/** \brief Constructor with control over UG's memory requirements
*
* \param heapSize The size of UG's internal memory in megabytes. UG allocates
......@@ -227,7 +215,7 @@ namespace Dune {
// **********************************************************
/** \brief The different forms of grid refinement that UG supports */
enum AdaptationType {
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 */
......@@ -237,7 +225,9 @@ namespace Dune {
};
/** \brief Sets the type of grid refinement */
void setAdaptationType(AdaptationType type);
void setRefinementType(RefinementType type) {
refinementType_ = type;
}
/** \brief Read access to the UG-internal grid name */
const std::string& name() const {return name_;}
......@@ -282,6 +272,9 @@ namespace Dune {
//! the UGGrid constructor are taken
bool useExistingDefaultsFile;
//! The type of grid refinement currently in use
RefinementType refinementType_;
protected:
/** \brief Number of UGGrids currently in use.
*
......
......@@ -206,7 +206,7 @@ inline UGGrid < dim, dimworld >::~UGGrid()
if (multigrid_) {
#ifdef _3
UG3d::DisposeMultiGrid(multigrid_);
//UG3d::DisposeMultiGrid(multigrid_);
#else
UG2d::DisposeMultiGrid(multigrid_);
#endif
......@@ -437,7 +437,9 @@ inline bool UGGrid < dim, dimworld >::adapt()
#ifdef _3
mode = UG3d::GM_REFINE_TRULY_LOCAL;
mode = mode | UG3d::GM_COPY_ALL;
if (refinementType_==COPY)
mode = mode | UG3d::GM_COPY_ALL;
// I don't really know what this means
int seq = UG3d::GM_REFINE_PARALLEL;
......@@ -448,7 +450,9 @@ inline bool UGGrid < dim, dimworld >::adapt()
rv = UG3d::AdaptMultiGrid(multigrid_,mode,seq,mgtest);
#else
mode = UG2d::GM_REFINE_TRULY_LOCAL;
mode = mode | UG2d::GM_COPY_ALL;
if (refinementType_==COPY)
mode = mode | UG2d::GM_COPY_ALL;
// I don't really know what this means
int seq = UG2d::GM_REFINE_PARALLEL;
......@@ -456,10 +460,23 @@ inline bool UGGrid < dim, dimworld >::adapt()
// I don't really know what this means either
int mgtest = UG2d::GM_REFINE_NOHEAPTEST;
/** \todo Why don't I have to mention the namespace?? */
rv = AdaptMultiGrid(multigrid_,mode,seq,mgtest);
#endif
std::cout << "adapt(): error code " << rv << "\n";
if (rv!=0)
DUNE_THROW(GridError, "UG::adapt() returned with error code " << rv);
// Collapse the complete grid hierarchy into a single level if requested
#ifdef _3
if (refinementType_==COLLAPSE)
if (UG3d::Collapse(multigrid_))
DUNE_THROW(GridError, "UG3d::Collapse returned error code!");
#else
if (refinementType_==COLLAPSE)
if (UG2d::Collapse(multigrid_))
DUNE_THROW(GridError, "UG2d::Collapse returned error code!");
#endif
/** \bug Should return true only if at least one element has actually
been refined */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment