Commit 291f8e28 authored by Kilian Lackhove's avatar Kilian Lackhove

Merge branch 'feature/FC-boolparams' into 'master'

Allow explicitly setting bool options of FieldConvert modules as false

See merge request !811
parents fc1ded97 a599d84e
......@@ -40,6 +40,7 @@ v5.0.0
- Add input module for Semtex field files (!777)
- Fixed interppoints module (!760)
- Move StreamFunction utility to a FieldConvert module (!809)
- Allow explicitly setting bool options of FieldConvert modules as false (!811)
- Enable output to multiple files (!844)
- Allow using xml file without expansion tag in FieldConvert (!849)
......
......@@ -109,7 +109,7 @@ void Module::RegisterConfig(string key, string val)
it->second.m_beenSet = true;
if (it->second.m_isBool)
if (it->second.m_isBool && val=="")
{
it->second.m_value = "1";
}
......
......@@ -196,7 +196,8 @@ public:
virtual ModulePriority GetModulePriority() = 0;
FIELD_UTILS_EXPORT void RegisterConfig(std::string key, std::string value);
FIELD_UTILS_EXPORT void RegisterConfig(std::string key,
std::string value = "");
FIELD_UTILS_EXPORT void PrintConfig();
FIELD_UTILS_EXPORT void SetDefaults();
......
......@@ -104,7 +104,7 @@ void OutputFileBase::Process(po::variables_map &vm)
}
if (m_f->m_writeBndFld)
{
int nfields = m_f->m_exp.size();
int nfields = m_f->m_variables.size();
int normdim = m_f->m_graph->GetMeshDimension();
// Prepare for normals output
......
......@@ -613,7 +613,7 @@ void OutputTecplotBinary::WriteDoubleOrFloat(std::ofstream &outfile,
Array<OneD, NekDouble> &data)
{
// Data format: either double or single depending on user options
bool useDoubles = m_config["double"].m_beenSet;
bool useDoubles = m_config["double"].as<bool>();
if (useDoubles)
{
......@@ -642,7 +642,7 @@ void OutputTecplotBinary::WriteTecplotZone(std::ofstream &outfile)
Array<OneD, NekDouble> fieldMax(m_fields.num_elements());
// Data format: either double or single depending on user options
bool useDoubles = m_config["double"].m_beenSet;
bool useDoubles = m_config["double"].as<bool>();
if ((m_oneOutputFile && m_f->m_comm->GetRank() == 0) || !m_oneOutputFile)
{
......
......@@ -59,7 +59,7 @@ ProcessBoundaryExtract::ProcessBoundaryExtract(FieldSharedPtr f)
// set up dafault values.
m_config["bnd"] = ConfigOption(false, "All", "Boundary to be processed");
m_config["addnormals"] =
ConfigOption(true, "NotSet", "Add normals to output");
ConfigOption(true, "0", "Add normals to output");
f->m_writeBndFld = true;
f->m_declareExpansionAsContField = true;
......@@ -72,7 +72,7 @@ ProcessBoundaryExtract::~ProcessBoundaryExtract()
void ProcessBoundaryExtract::Process(po::variables_map &vm)
{
m_f->m_addNormals = m_config["addnormals"].m_beenSet;
m_f->m_addNormals = m_config["addnormals"].as<bool>();
// Set up Field options to output boundary fld
string bvalues = m_config["bnd"].as<string>();
......
......@@ -108,7 +108,7 @@ ProcessDisplacement::ProcessDisplacement(FieldSharedPtr f)
ConfigOption(false, "", "Name of file containing high order boundary");
m_config["usevertexids"] = ConfigOption(
false, "0", "Use vertex IDs instead of face IDs for matching");
true, "0", "Use vertex IDs instead of face IDs for matching");
}
ProcessDisplacement::~ProcessDisplacement()
......@@ -129,7 +129,7 @@ void ProcessDisplacement::Process(po::variables_map &vm)
return;
}
bool useVertexIds = m_config["usevertexids"].m_beenSet;
bool useVertexIds = m_config["usevertexids"].as<bool>();
vector<string> files;
files.push_back(toFile);
......
......@@ -60,10 +60,10 @@ ProcessEquiSpacedOutput::ProcessEquiSpacedOutput(FieldSharedPtr f)
: ProcessModule(f)
{
m_config["tetonly"] =
ConfigOption(true, "NotSet", "Only process tetrahedral elements");
ConfigOption(true, "0", "Only process tetrahedral elements");
m_config["modalenergy"] =
ConfigOption(true, "NotSet", "Write output as modal energy");
ConfigOption(true, "0", "Write output as modal energy");
}
ProcessEquiSpacedOutput::~ProcessEquiSpacedOutput()
......@@ -199,7 +199,7 @@ void ProcessEquiSpacedOutput::Process(po::variables_map &vm)
for (int i = 0; i < nel; ++i)
{
e = m_f->m_exp[0]->GetExp(i);
if (m_config["tetonly"].m_beenSet)
if (m_config["tetonly"].as<bool>())
{
if (m_f->m_exp[0]->GetExp(i)->DetShapeType() !=
LibUtilities::eTetrahedron)
......@@ -365,7 +365,7 @@ void ProcessEquiSpacedOutput::Process(po::variables_map &vm)
cnt = 0;
int cnt1 = 0;
if (m_config["modalenergy"].m_beenSet)
if (m_config["modalenergy"].as<bool>())
{
Array<OneD, const NekDouble> phys = m_f->m_exp[n]->GetPhys();
for (int i = 0; i < nel; ++i)
......
......@@ -58,7 +58,7 @@ ProcessHomogeneousPlane::ProcessHomogeneousPlane(FieldSharedPtr f)
{
m_config["planeid"] = ConfigOption(false, "NotSet", "plane id to extract");
m_config["wavespace"] =
ConfigOption(true, "NotSet", "Extract plane in Fourier space");
ConfigOption(true, "0", "Extract plane in Fourier space");
}
ProcessHomogeneousPlane::~ProcessHomogeneousPlane()
......@@ -108,7 +108,7 @@ void ProcessHomogeneousPlane::Process(po::variables_map &vm)
int n = s * nfields + i;
m_f->m_exp[n] = m_f->m_exp[n]->GetPlane(plane);
if (m_config["wavespace"].m_beenSet)
if (m_config["wavespace"].as<bool>())
{
m_f->m_exp[n]->BwdTrans(m_f->m_exp[n]->GetCoeffs(),
m_f->m_exp[n]->UpdatePhys());
......
......@@ -63,7 +63,7 @@ ProcessInnerProduct::ProcessInnerProduct(FieldSharedPtr f) : ProcessModule(f)
false, "NotSet", "Take inner product of multiple field fields with "
"ids given in string. i.e. file_0.chk file_1.chk ...");
m_config["allfromflds"] =
ConfigOption(true, "NotSet", "Take inner product between all fromflds, "
ConfigOption(true, "0", "Take inner product between all fromflds, "
"requires multifldids to be set");
}
......@@ -101,7 +101,7 @@ void ProcessInnerProduct::Process(po::variables_map &vm)
string multifldidsstr = m_config["multifldids"].as<string>();
vector<unsigned int> multiFldIds;
vector<string> fromfiles;
bool allfromflds = m_config["allfromflds"].m_beenSet;
bool allfromflds = m_config["allfromflds"].as<bool>();
if (fields.compare("All") == 0)
{
......
......@@ -82,11 +82,11 @@ ProcessIsoContour::ProcessIsoContour(FieldSharedPtr f) :
m_config["fieldvalue"] = ConfigOption(false, "NotSet",
"field value to extract");
m_config["globalcondense"] = ConfigOption(true, "NotSet",
m_config["globalcondense"] = ConfigOption(true, "0",
"Globally condense contour to unique "
"values");
m_config["smooth"] = ConfigOption(true, "NotSet",
m_config["smooth"] = ConfigOption(true, "0",
"Smooth isocontour (might require "
"globalcondense)");
......@@ -197,8 +197,8 @@ void ProcessIsoContour::Process(po::variables_map &vm)
}
// Process isocontour
bool smoothing = m_config["smooth"].m_beenSet;
bool globalcondense = m_config["globalcondense"].m_beenSet;
bool smoothing = m_config["smooth"].as<bool>();
bool globalcondense = m_config["globalcondense"].as<bool>();
if(globalcondense)
{
if(verbose)
......
......@@ -61,7 +61,7 @@ ModuleKey ProcessQualityMetric::className =
ProcessQualityMetric::ProcessQualityMetric(FieldSharedPtr f) : ProcessModule(f)
{
m_config["scaled"] =
ConfigOption(true, "", "use scaled jacobian instead");
ConfigOption(true, "0", "use scaled jacobian instead");
}
ProcessQualityMetric::~ProcessQualityMetric()
......@@ -101,7 +101,7 @@ void ProcessQualityMetric::Process(po::variables_map &vm)
// copy Jacobian into field
LocalRegions::ExpansionSharedPtr Elmt = exp->GetExp(i);
int offset = exp->GetPhys_Offset(i);
Array<OneD, NekDouble> q = GetQ(Elmt,m_config["scaled"].m_beenSet);
Array<OneD, NekDouble> q = GetQ(Elmt,m_config["scaled"].as<bool>());
Array<OneD, NekDouble> out = phys + offset;
ASSERTL0(q.num_elements() == Elmt->GetTotPoints(),
......
......@@ -433,7 +433,7 @@ void FilterFieldConvert::CreateModules( vector<string> &modcmds)
if (tmp2.size() == 1)
{
mod->RegisterConfig(tmp2[0], "1");
mod->RegisterConfig(tmp2[0]);
}
else if (tmp2.size() == 2)
{
......@@ -467,6 +467,7 @@ void FilterFieldConvert::CreateModules( vector<string> &modcmds)
module.second = string("equispacedoutput");
mod = GetModuleFactory().CreateInstance(module, m_f);
m_modules.insert(m_modules.end()-1, mod);
mod->SetDefaults();
}
// Check if modules provided are compatible
......
......@@ -371,7 +371,7 @@ int main(int argc, char* argv[])
if (tmp2.size() == 1)
{
mod->RegisterConfig(tmp2[0], "1");
mod->RegisterConfig(tmp2[0]);
}
else if (tmp2.size() == 2)
{
......@@ -394,6 +394,7 @@ int main(int argc, char* argv[])
module.second = string("createExp");
mod = GetModuleFactory().CreateInstance(module, f);
modules.push_back(mod);
mod->SetDefaults();
// Include equispacedoutput module if needed
Array< OneD, int> modulesCount(SIZE_ModulePriority,0);
......@@ -409,6 +410,7 @@ int main(int argc, char* argv[])
module.second = string("equispacedoutput");
mod = GetModuleFactory().CreateInstance(module, f);
modules.push_back(mod);
mod->SetDefaults();
}
// Check if modules provided are compatible
......
Markdown is supported
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