Commit 116170e9 authored by Julian Marcon's avatar Julian Marcon
Browse files

Added periodic tag reading in .mcf reader.

parent a8fbc4da
......@@ -39,6 +39,8 @@
#include <LibUtilities/BasicUtils/ParseUtils.hpp>
#include <LibUtilities/BasicUtils/Progressbar.hpp>
#include <boost/algorithm/string.hpp>
using namespace std;
namespace Nektar
{
......@@ -55,6 +57,8 @@ Generator2D::Generator2D(MeshSharedPtr m) : ProcessModule(m)
ConfigOption(false, "0", "Generate parallelograms on these curves");
m_config["blthick"] =
ConfigOption(false, "0", "Parallelogram layer thickness");
m_config["periodic"] =
ConfigOption(false, "0", "Set of pairs of periodic curves");
}
Generator2D::~Generator2D()
......@@ -71,6 +75,42 @@ void Generator2D::Process()
m_mesh->m_numNodes = m_mesh->m_cad->GetNumVerts();
if (m_config["periodic"].beenSet)
{
m_periodicPairs.clear();
set<unsigned> alreadyPeriodic;
string s = m_config["periodic"].as<string>();
vector<string> lines;
boost::split(lines, s, boost::is_any_of(":"));
for (int i = 0; i < lines.size(); i++)
{
vector<unsigned> data;
ParseUtils::GenerateOrderedVector(lines[i].c_str(), data);
ASSERTL0(data.size() == 2, "periodic pairs ill-defined");
ASSERTL0(!alreadyPeriodic.count(data[0]), "curve already periodic");
ASSERTL0(!alreadyPeriodic.count(data[1]), "curve already periodic");
m_periodicPairs[data[0]] = data[1];
alreadyPeriodic.insert(data[0]);
alreadyPeriodic.insert(data[1]);
}
if (m_mesh->m_verbose)
{
cout << "\t\tPeriodic boundary conditions" << endl;
for (map<unsigned, unsigned>::iterator it = m_periodicPairs.begin();
it != m_periodicPairs.end(); ++it)
{
cout << "\t\t\tCurves " << it->first << " => " << it->second << endl;
}
cout << endl;
}
}
// linear mesh all curves
for (int i = 1; i <= m_mesh->m_cad->GetNumCurve(); i++)
{
......
......@@ -74,6 +74,8 @@ private:
std::map<int, FaceMeshSharedPtr> m_facemeshes;
/// map of individual curve meshes of the curves in the domain
std::map<int, CurveMeshSharedPtr> m_curvemeshes;
/// map of periodic curve pairs
std::map<unsigned, unsigned> m_periodicPairs;
std::vector<unsigned int> m_blCurves;
NekDouble m_thickness;
......
......@@ -151,6 +151,21 @@ void InputCAD::ParseFile(string nm)
}
}
set<string> periodic;
if (pSession->DefinesElement("NEKTAR/MESHING/PERIODIC"))
{
TiXmlElement *per = mcf->FirstChildElement("PERIODIC");
TiXmlElement *pair = per->FirstChildElement("P");
while (pair)
{
string tmp;
pair->QueryStringAttribute("PAIR", &tmp);
periodic.insert(tmp);
pair = pair->NextSiblingElement("P");
}
}
map<string,string>::iterator it;
it = information.find("CADFile");
......@@ -249,6 +264,18 @@ void InputCAD::ParseFile(string nm)
m_refinement = ss.str();
m_refinement.erase(m_refinement.end()-1);
}
if (periodic.size() > 0)
{
stringstream ss;
for (sit = periodic.begin(); sit != periodic.end(); ++sit)
{
ss << *sit;
ss << ":";
}
m_periodic = ss.str();
m_periodic.erase(m_periodic.end() - 1);
}
}
void InputCAD::Process()
......@@ -301,6 +328,10 @@ void InputCAD::Process()
mods.back()->RegisterConfig("blcurves", m_blsurfs);
mods.back()->RegisterConfig("blthick", m_blthick);
}
if (m_periodic.size())
{
mods.back()->RegisterConfig("periodic", m_periodic);
}
}
else
{
......
......@@ -63,7 +63,7 @@ public:
private:
std::string m_minDelta, m_maxDelta, m_eps, m_cadfile, m_order,
m_blsurfs, m_blthick, m_blprog, m_bllayers, m_refinement,
m_nacadomain;
m_nacadomain, m_periodic;
bool m_makeBL, m_surfopti, m_varopti, m_refine, m_woct, m_2D, m_splitBL,
m_naca;
......
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