Commit 753db752 authored by Dave Moxey's avatar Dave Moxey
Browse files

Fixed boundary region numbering in Semtex converter.

Fixed minor bug in last commit.


git-svn-id: https://gforge.sci.utah.edu/svn/nektar/trunk@4047 305cdda6-5ce1-45b3-a98d-dfc68c8b3305
parent 3838c7fd
......@@ -450,11 +450,10 @@ namespace Nektar
getline(mshFile, line);
ss.clear(); ss.str(line);
ss >> id >> tag;
conditionMap[tag] = id;
if (maxTag < id)
maxTag = id;
++i;
conditionMap[tag] = i++;
}
maxTag = i;
// Now read in actual values for boundary conditions from BCS
// section.
......@@ -535,7 +534,7 @@ namespace Nektar
// Finally set composite for condition. In this case, all
// composites will be lines so there is one set per
// composite.
p->composite.push_back(conditionMap[tag]);
p->composite.push_back(conditionMap[tag]+1);
++i;
}
......@@ -572,7 +571,7 @@ namespace Nektar
// periodic conditions.
if (periodicTagId == -1)
{
periodicTagId = maxTag+1;
periodicTagId = maxTag;
ConditionSharedPtr in =
ConditionSharedPtr(new Condition());
ConditionSharedPtr out =
......@@ -588,8 +587,8 @@ namespace Nektar
out->value.push_back("["+boost::lexical_cast<
string>(periodicTagId)+"]");
}
in-> composite.push_back(periodicTagId);
out->composite.push_back(periodicTagId+1);
in-> composite.push_back(periodicTagId+1);
out->composite.push_back(periodicTagId+2);
m-> condition[periodicTagId] = in;
m-> condition[periodicTagId+1] = out;
}
......@@ -603,18 +602,19 @@ namespace Nektar
pair<int, int> c1(elmt, side );
pair<int, int> c2(elmtB, sideB);
if (visitedPeriodic.count(c1) == 0 && visitedPeriodic.count(c2) == 0)
if (visitedPeriodic.count(c1) == 0 &&
visitedPeriodic.count(c2) == 0)
{
visitedPeriodic.insert(make_pair(elmtB, sideB));
visitedPeriodic.insert(make_pair(elmt, side ));
insertEdge(elmt, side, periodicTagId);
insertEdge(elmtB, sideB, periodicTagId+1);
insertEdge(elmt, side, periodicTagId+1);
insertEdge(elmtB, sideB, periodicTagId+2);
}
}
else if (word == "<B>")
{
ss >> tag;
insertEdge(elmt, side, conditionMap[tag]);
insertEdge(elmt, side, conditionMap[tag]+1);
}
else
{
......
......@@ -219,7 +219,7 @@ namespace Nektar
e->SetAttribute("EDGEID", (*it)->id);
e->SetAttribute("NUMPOINTS", (*it)->GetNodeCount());
e->SetAttribute("TYPE",
LibUtilities::kPointsTypeStr[(*it)->curveType]);
LibUtilities::kPointsTypeStr[(*it)->curveType]);
TiXmlText * t0 = new TiXmlText((*it)->GetXmlCurveString());
e->LinkEndChild(t0);
curved->LinkEndChild(e);
......@@ -239,7 +239,7 @@ namespace Nektar
f->SetAttribute("FACEID", (*it2)->id);
f->SetAttribute("NUMPOINTS",(*it2)->GetNodeCount());
f->SetAttribute("TYPE",
LibUtilities::kPointsTypeStr[(*it2)->curveType]);
LibUtilities::kPointsTypeStr[(*it2)->curveType]);
TiXmlText * t0 = new TiXmlText((*it2)->GetXmlCurveString());
f->LinkEndChild(t0);
curved->LinkEndChild(f);
......@@ -254,9 +254,9 @@ namespace Nektar
TiXmlElement* verTag = new TiXmlElement("COMPOSITE");
CompositeMap::iterator it;
ConditionMap::iterator it2;
int cnt = 0;
int j = 0;
for (it = m->composite.begin(); it != m->composite.end(); ++it, ++cnt)
for (it = m->composite.begin(); it != m->composite.end(); ++it, ++j)
{
if (it->second->items.size() > 0)
{
......@@ -265,11 +265,21 @@ namespace Nektar
bool doSort = true;
// Ensure that this composite is not used for periodic BCs!
for (it2 = m->condition.begin(); it2 != m->condition.end(); ++it2)
for (it2 = m->condition.begin();
it2 != m->condition.end(); ++it2)
{
for (int i = 0; i < it2->second->composite.size(); ++i)
ConditionSharedPtr c = it2->second;
// Ignore non-periodic boundary conditions.
if (find(c->type.begin(), c->type.end(), ePeriodic) ==
c->type.end())
{
if (it2->second->composite[i] == cnt)
continue;
}
for (int i = 0; i < c->composite.size(); ++i)
{
if (c->composite[i] == j)
{
doSort = false;
}
......@@ -277,16 +287,18 @@ namespace Nektar
}
comp_tag->SetAttribute("ID", it->second->id);
comp_tag->LinkEndChild( new TiXmlText(it->second->GetXmlString(doSort)) );
comp_tag->LinkEndChild(
new TiXmlText(it->second->GetXmlString(doSort)));
verTag->LinkEndChild(comp_tag);
}
else
{
cout << "Composite " << it->second->id << " contains nothing." << endl;
cout << "Composite " << it->second->id << " "
<< "contains nothing." << endl;
}
}
pRoot->LinkEndChild( verTag );
pRoot->LinkEndChild(verTag);
}
void OutputNekpp::WriteXmlDomain(TiXmlElement * pRoot)
......@@ -351,12 +363,15 @@ namespace Nektar
void OutputNekpp::WriteXmlConditions(TiXmlElement * pRoot)
{
TiXmlElement *conditions = new TiXmlElement ("CONDITIONS");
TiXmlElement *conditions =
new TiXmlElement("CONDITIONS");
TiXmlElement *boundaryregions =
new TiXmlElement("BOUNDARYREGIONS");
TiXmlElement *boundaryconditions =
new TiXmlElement("BOUNDARYCONDITIONS");
TiXmlElement *variables =
new TiXmlElement("VARIABLES");
ConditionMap::iterator it;
TiXmlElement *boundaryregions = new TiXmlElement("BOUNDARYREGIONS");
TiXmlElement *boundaryconditions = new TiXmlElement("BOUNDARYCONDITIONS");
TiXmlElement *variables = new TiXmlElement("VARIABLES");
for (it = m->condition.begin(); it != m->condition.end(); ++it)
{
......@@ -379,7 +394,8 @@ namespace Nektar
boundaryregions->LinkEndChild(b);
TiXmlElement *region = new TiXmlElement("REGION");
region->SetAttribute("REF", boost::lexical_cast<string>(it->first));
region->SetAttribute(
"REF", boost::lexical_cast<string>(it->first));
for (int i = 0; i < c->type.size(); ++i)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment