Commit abdeefd2 authored by Julian Marcon's avatar Julian Marcon
Browse files

Re-enabled automatic peralign call.

parent ab28ef27
...@@ -340,6 +340,7 @@ void InputMCF::Process() ...@@ -340,6 +340,7 @@ void InputMCF::Process()
if(m_2D) if(m_2D)
{ {
////**** 2DGenerator ****////
m_mesh->m_expDim = 2; m_mesh->m_expDim = 2;
m_mesh->m_spaceDim = 2; m_mesh->m_spaceDim = 2;
mods.push_back(GetModuleFactory().CreateInstance( mods.push_back(GetModuleFactory().CreateInstance(
...@@ -416,62 +417,30 @@ void InputMCF::Process() ...@@ -416,62 +417,30 @@ void InputMCF::Process()
mods.back()->RegisterConfig("r",m_blprog); mods.back()->RegisterConfig("r",m_blprog);
} }
for(int i = 0; i < mods.size(); i++) ////**** Peralign ****////
{ if (m_2D && m_periodic.size())
mods[i]->SetDefaults();
mods[i]->Process();
}
// Run peralign
/*if (m_periodic.size())
{ {
mods.clear();
vector<string> lines; vector<string> lines;
boost::split(lines, m_periodic, boost::is_any_of(":")); boost::split(lines, m_periodic, boost::is_any_of(":"));
for (vector<string>::iterator il = lines.begin(); il != lines.end(); for (vector<string>::iterator il = lines.begin(); il != lines.end();
++il) ++il)
{ {
vector<string> tmp(2);
vector<unsigned> data(2);
boost::split(tmp, *il, boost::is_any_of(","));
data[0] = boost::lexical_cast<unsigned>(tmp[0]);
data[1] = boost::lexical_cast<unsigned>(tmp[1]);
mods.push_back(GetModuleFactory().CreateInstance( mods.push_back(GetModuleFactory().CreateInstance(
ModuleKey(eProcessModule, "peralign"), m_mesh)); ModuleKey(eProcessModule, "peralign"), m_mesh));
vector<string> tmp(2);
boost::split(tmp, *il, boost::is_any_of(","));
mods.back()->RegisterConfig("surf1", tmp[0]); mods.back()->RegisterConfig("surf1", tmp[0]);
mods.back()->RegisterConfig("surf2", tmp[1]); mods.back()->RegisterConfig("surf2", tmp[1]);
Array<OneD, NekDouble> P11 =
m_mesh->m_cad->GetCurve(data[0])->GetVertex()[0]->GetLoc();
Array<OneD, NekDouble> P12 =
m_mesh->m_cad->GetCurve(data[0])->GetVertex()[1]->GetLoc();
Array<OneD, NekDouble> P21 =
m_mesh->m_cad->GetCurve(data[1])->GetVertex()[0]->GetLoc();
Array<OneD, NekDouble> P22 =
m_mesh->m_cad->GetCurve(data[1])->GetVertex()[1]->GetLoc();
Array<OneD, NekDouble> T(2);
T[0] = (P21[0] + P22[0] - P11[0] - P12[0]) / 2;
T[1] = (P21[1] + P22[1] - P11[1] - P12[1]) / 2;
NekDouble mag = sqrt(T[0] * T[0] + T[1] * T[1]);
stringstream ss;
ss << T[0] / mag << "," << T[1] / mag << "," << 0.0;
mods.back()->RegisterConfig("dir", ss.str());
} }
}
for(int i = 0; i < mods.size(); i++) for(int i = 0; i < mods.size(); i++)
{ {
mods[i]->SetDefaults(); mods[i]->SetDefaults();
mods[i]->Process(); mods[i]->Process();
} }
}*/
} }
} }
} }
...@@ -113,16 +113,29 @@ void ProcessPerAlign::Process() ...@@ -113,16 +113,29 @@ void ProcessPerAlign::Process()
if (tmp1.size() == 1) if (tmp1.size() == 1)
{ {
if (dir != "x" && dir != "y" && dir != "z") if (!dir.size() && m_mesh->m_spaceDim == 2)
{ {
cerr << "WARNING: dir must be set to either x, y or z. " Array<OneD, NekDouble> T =
<< "Skipping periodic alignment." << endl; m_mesh->m_cad->GetPeriodicTranslationVector(surf1, surf2);
return; NekDouble mag = sqrt(T[0] * T[0] + T[1] * T[1]);
vec[0] = T[0] / mag;
vec[1] = T[1] / mag;
vec[2] = T[2] / mag;
} }
else
{
if (dir != "x" && dir != "y" && dir != "z")
{
cerr << "WARNING: dir must be set to either x, y or z. "
<< "Skipping periodic alignment." << endl;
return;
}
vec[0] = dir == "x" ? 1.0 : 0.0; vec[0] = dir == "x" ? 1.0 : 0.0;
vec[1] = dir == "y" ? 1.0 : 0.0; vec[1] = dir == "y" ? 1.0 : 0.0;
vec[2] = dir == "z" ? 1.0 : 0.0; vec[2] = dir == "z" ? 1.0 : 0.0;
}
} }
else if (tmp1.size() == 3) else if (tmp1.size() == 3)
{ {
......
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