Skip to content

Commit

Permalink
Merge branch 'master' into simmetrix
Browse files Browse the repository at this point in the history
  • Loading branch information
ibaned committed May 25, 2015
2 parents 8be282d + 1074060 commit 150576c
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 17 deletions.
4 changes: 3 additions & 1 deletion apf/apfMesh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,9 @@ void NormalSharing::getCopies(MeshEntity* e,
for now, we'll build a full neighbor count
system into this object just to implement
the min-count rule for matched neighbors */
MatchedSharing::MatchedSharing(Mesh* m):helper(m),mesh(m)
MatchedSharing::MatchedSharing(Mesh* m):
mesh(m),
helper(m)
{
formCountMap();
}
Expand Down
2 changes: 1 addition & 1 deletion apf/apfMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,13 @@ struct MatchedSharing : public Sharing
virtual bool isOwned(MeshEntity* e);
virtual void getCopies(MeshEntity* e,
CopyArray& copies);
Mesh* mesh;
private:
size_t getNeighborCount(int peer);
bool isLess(Copy const& a, Copy const& b);
void getNeighbors(Parts& neighbors);
void formCountMap();
NormalSharing helper;
Mesh* mesh;
std::map<int, size_t> countMap;
};

Expand Down
3 changes: 1 addition & 2 deletions phasta/phAxisymmetry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,10 @@ static bool requiresRotation(gmi_model* gm, BCs& bcs, gmi_ent* e, gmi_ent* oe,
return true;
}

apf::MeshTag* tagAngles(apf::Mesh* m, BCs& bcs)
apf::MeshTag* tagAngles(apf::Mesh* m, BCs& bcs, apf::MatchedSharing* ms)
{
apf::MeshTag* tag = m->createDoubleTag("ph_angle", 1);
gmi_model* gm = m->getModel();
apf::MatchedSharing* ms = new apf::MatchedSharing(m);
PCU_Comm_Begin();
apf::MeshIterator* it = m->begin(0);
apf::MeshEntity* v;
Expand Down
2 changes: 1 addition & 1 deletion phasta/phAxisymmetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace ph {
bool getAxisymmetry(gmi_model* gm, gmi_ent* f, gmi_ent* of,
apf::Line& axis, double& angle);
void attachAllAngleBCs(gmi_model* gm, BCs& bcs);
apf::MeshTag* tagAngles(apf::Mesh* m, BCs& bcs);
apf::MeshTag* tagAngles(apf::Mesh* m, BCs& bcs, apf::MatchedSharing* ms);

}

Expand Down
32 changes: 22 additions & 10 deletions phasta/phOutput.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,27 @@ static void getLocalPeriodicMasters(Output& o, apf::Numbering* n)
delete sh;
}

static bool isMatchingSlave(apf::MatchedSharing* ms, apf::MeshEntity* v)
{
if (!ms)
return false;
apf::Matches matches;
ms->mesh->getMatches(v, matches);
if (!matches.getSize())
return false;
return !ms->isOwned(v);
}

static void getEssentialBCs(BCs& bcs, Output& o)
{
Input& in = *o.in;
apf::Mesh* m = o.mesh;
apf::MeshTag* angles = 0;
apf::MatchedSharing* ms = 0;
if (m->hasMatching())
ms = new apf::MatchedSharing(m);
if (in.axisymmetry)
angles = tagAngles(m, bcs);
angles = tagAngles(m, bcs, ms);
int nv = m->count(0);
o.arrays.nbc = new int[nv];
for (int i = 0; i < nv; ++i)
Expand All @@ -236,16 +250,13 @@ static void getEssentialBCs(BCs& bcs, Output& o)
bc[j] = 0;
bool hasBC = applyEssentialBCs(gm, ge, bcs, x, bc, &ibc);
/* matching introduces an iper bit */
/* which is set only for local slaves */
if (o.arrays.iper[i] != 0) {
ibc |= (1<<10);
hasBC = true;
}
/* axisymmetric theta for all global non-owners */
if (in.axisymmetry && m->hasTag(v, angles)) {
ibc |= (1<<11);
m->getDoubleTag(v, angles, &bc[11]);
/* which is set for all slaves */
if (isMatchingSlave(ms, v)) {
hasBC = true;
ibc |= (1<<10);
/* axisymmetric theta for some slaves */
if (in.axisymmetry && m->hasTag(v, angles))
m->getDoubleTag(v, angles, &bc[11]);
}
if (hasBC) {
o.arrays.nbc[i] = ei + 1;
Expand All @@ -262,6 +273,7 @@ static void getEssentialBCs(BCs& bcs, Output& o)
delete [] bc;
if (in.axisymmetry)
m->destroyTag(angles);
delete ms;
}

static void getInitialConditions(BCs& bcs, Output& o)
Expand Down
4 changes: 2 additions & 2 deletions phasta/phOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ struct EnsaArrays
/* ibc[i] is the essential boundary condition
status code of essential BC node i */
/* ibc bits are as follows:
var: rho t p u v w sc1 sc2 sc3 sc4 perio axibc
bit: 0 1 2 3 4 5 6 7 8 9 10 11 */
var: rho t p u v w sc1 sc2 sc3 sc4 perio
bit: 0 1 2 3 4 5 6 7 8 9 10 */
int* ibc;
/* bc[i][j] is the essential boundary condition
value of
Expand Down

0 comments on commit 150576c

Please sign in to comment.