Skip to content

Commit

Permalink
Merging develop into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Nightly Bot authored and cwsmith committed Jun 2, 2021
2 parents 4d659af + 15bb927 commit dd107ee
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
45 changes: 45 additions & 0 deletions ma/maDBG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "maDBG.h"
#include "maShape.h"
#include "maAdapt.h"
#include "maRefine.h"
#include <gmi.h>
#include <gmi_null.h>
#include <PCU.h>
Expand Down Expand Up @@ -386,4 +387,48 @@ void visualizeSizeField(
apf::destroyMesh(msf);
}

struct SplitByTag : public ma::Predicate
{
SplitByTag(ma::Adapt* a_, int type_, int tag_) :
a(a_), type(type_), tag(tag_) {}
bool operator() (ma::Entity* e) {
ma::Mesh* m = a->mesh;
int mtype = m->getModelType(m->toModel(e));
int mtag = m->getModelTag(m->toModel(e));
if (mtype != type) return false;
if (mtag != tag ) return false;
return true;
}
ma::Adapt* a;
int type;
int tag;
};

void uniformAdaptByModelTag(
apf::Mesh2* m,
int mtype,
int mtag,
int level)
{
ma::Input* in = ma::configureUniformRefine(m, 0);
ma::validateInput(in);
ma::Adapt* a = new ma::Adapt(in);
for(int i = 0; i < level; i++) {
SplitByTag p(a, mtype, mtag);
ma::markEntities(a, 1, p, ma::SPLIT, ma::NEED_NOT_SPLIT,
ma::DONT_SPLIT | ma::NEED_NOT_SPLIT);
PCU_ALWAYS_ASSERT(ma::checkFlagConsistency(a,1,ma::SPLIT));
ma::Refine* r = a->refine;
ma::resetCollection(r);
ma::collectForTransfer(r);
ma::collectForMatching(r);
ma::addAllMarkedEdges(r);
ma::splitElements(r);
ma::processNewElements(r);
ma::destroySplitElements(r);
ma::forgetNewEntities(r);
}
delete(a);
}

}
6 changes: 5 additions & 1 deletion ma/maDBG.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ void visualizeSizeField(
int smapleSize[2],
double userScale,
const char* OutputPrefix);

void uniformAdaptByModelTag(
apf::Mesh2* m,
int mtype,
int mtag,
int level);
}
#endif

0 comments on commit dd107ee

Please sign in to comment.