50 ModuleKey ProcessC0Projection::className =
53 ProcessC0Projection::create,
"Computes C0 projection.");
68 cout <<
"ProcessC0Projection: Projecting field into C0 space..."
74 if(
m_f->m_graph->GetMeshDimension() == 3)
76 if(boost::iequals(
m_f->m_session->GetSolverInfo(
"GLOBALSYSSOLN"),
77 "IterativeStaticCond"))
79 if(boost::iequals(
m_f->m_session->GetSolverInfo(
"PRECONDITIONER"),
82 m_f->m_session->SetSolverInfo(
"PRECONDITIONER",
"LowEnergyBlock");
84 if(boost::iequals(
m_f->m_session->GetSolverInfo(
"PRECONDITIONER"),
85 "FullLinearSpaceWithDiagonal"))
87 m_f->m_session->SetSolverInfo(
"PRECONDITIONER",
"FullLinearSpaceWithLowEnergyBlock");
92 cout <<
"Resetting diagonal precondition to low energy block " << endl;;
99 bool savedef =
m_f->m_declareExpansionAsContField;
100 m_f->m_declareExpansionAsContField =
true;
102 m_f->AppendExpList(
m_f->m_fielddef[0]->m_numHomogeneousDir,
104 m_f->m_declareExpansionAsContField = savedef;
106 int nfields =
m_f->m_exp.size();
108 string fields =
m_config[
"fields"].as<
string>();
109 vector<unsigned int> processFields;
111 if(fields.compare(
"All") == 0)
113 for(
int i = 0; i < nfields; ++i)
115 processFields.push_back(i);
122 "Failed to interpret field string in C0Projection");
125 for (
int i = 0; i < processFields.size(); ++i)
127 ASSERTL0(processFields[i] < nfields,
128 "Attempt to process field that is larger than then number of "
133 cout <<
"\t Processing field: " << processFields[i] << endl;
135 C0ProjectExp->BwdTrans(
m_f->m_exp[processFields[i]]->GetCoeffs(),
136 m_f->m_exp[processFields[i]]->UpdatePhys());
137 C0ProjectExp->FwdTrans(
m_f->m_exp[processFields[i]]->GetPhys(),
138 m_f->m_exp[processFields[i]]->UpdateCoeffs());
142 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
143 =
m_f->m_exp[0]->GetFieldDefinitions();
145 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
147 for(
int i = 0; i < nfields; ++i)
149 for (
int j = 0; j < FieldDef.size(); ++j)
151 FieldDef[j]->m_fields.push_back(
m_f->m_fielddef[0]->m_fields[i]);
152 m_f->m_exp[i]->AppendFieldData(FieldDef[j], FieldData[j]);
156 m_f->m_fielddef = FieldDef;
157 m_f->m_data = FieldData;
#define ASSERTL0(condition, msg)
pair< ModuleType, string > ModuleKey
static bool GenerateOrderedVector(const char *const str, std::vector< unsigned int > &vec)
virtual ~ProcessC0Projection()
map< string, ConfigOption > m_config
List of configuration values.
FieldSharedPtr m_f
Field object.
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
boost::shared_ptr< Field > FieldSharedPtr
Represents a command-line configuration option.
ModuleFactory & GetModuleFactory()
Abstract base class for processing modules.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.