50 ModuleKey ProcessC0Projection::className =
 
   53     ProcessC0Projection::create, 
"Computes C0 projection.");
 
   58     m_config[
"localtoglobalmap"] = 
ConfigOption(
true,
"0",
"Just perform a local to global mapping and back");
 
   59     m_config[
"usexmlbcs"] = 
ConfigOption(
true,
"0",
"Use boundary conditions given in xml file. Requires all projected fields to be defined in xml file");
 
   60     m_config[
"helmsmoothing"] = 
ConfigOption(
false,
"Not Set",
"Use a Helmholtz smoother to remove high frequency components above specified L");
 
   62     f->m_declareExpansionAsContField = 
true;
 
   73         if(
m_f->m_comm->TreatAsRankZero())
 
   75             cout << 
"ProcessC0Projection: Projecting field into C0 space..." 
   82     if(
m_f->m_graph->GetMeshDimension() == 3)
 
   84         if(boost::iequals(
m_f->m_session->GetSolverInfo(
"GLOBALSYSSOLN"),
 
   85                           "IterativeStaticCond"))
 
   87             if(boost::iequals(
m_f->m_session->GetSolverInfo(
"PRECONDITIONER"),
 
   90                 m_f->m_session->SetSolverInfo(
"PRECONDITIONER",
"LowEnergyBlock");
 
   92             if(boost::iequals(
m_f->m_session->GetSolverInfo(
"PRECONDITIONER"),
 
   93                               "FullLinearSpaceWithDiagonal"))
 
   95                 m_f->m_session->SetSolverInfo(
"PRECONDITIONER",
"FullLinearSpaceWithLowEnergyBlock");
 
  100                 if(
m_f->m_comm->GetRank() == 0)
 
  102                     cout << 
"Resetting diagonal precondition to low energy block " << endl;
 
  107     bool JustPerformLocToGloMap = 
m_config[
"localtoglobalmap"].as<
bool>();
 
  108     bool HelmSmoother = (boost::iequals(
m_config[
"helmsmoothing"].as<string>(),
"Not Set"))? 
false:
true;
 
  109     int nfields = 
m_f->m_exp.size();
 
  111     if(
m_config[
"usexmlbcs"].as<bool>())
 
  113         for(
int i = 0; i < nfields; ++i)
 
  115             C0ProjectExp[i] = 
m_f->m_exp[i];
 
  121         bool savedef = 
m_f->m_declareExpansionAsContField;
 
  122         bool savedef2 = 
m_f->m_requireBoundaryExpansion;
 
  123         m_f->m_declareExpansionAsContField = 
true;
 
  124         m_f->m_requireBoundaryExpansion    = 
false;
 
  125         C0ProjectExp[0] = 
m_f->AppendExpList(
m_f->m_fielddef[0]->m_numHomogeneousDir,
 
  127         m_f->m_declareExpansionAsContField = savedef;
 
  128         m_f->m_requireBoundaryExpansion    = savedef2;
 
  129         for(
int i = 1; i < nfields; ++i)
 
  131             C0ProjectExp[i] = C0ProjectExp[0];
 
  135     string fields = 
m_config[
"fields"].as<
string>();
 
  136     vector<unsigned int> processFields;
 
  138     if(fields.compare(
"All") == 0)
 
  140         for(
int i = 0; i < nfields; ++i)
 
  142             processFields.push_back(i);
 
  149                  "Failed to interpret field string in C0Projection");
 
  152     for (
int i = 0; i < processFields.size(); ++i)
 
  154         ASSERTL0(processFields[i] < nfields,
 
  155                  "Attempt to process field that is larger than then number of " 
  160             if(
m_f->m_comm->GetRank() == 0)
 
  162                 cout << 
"\t Processing field: " << processFields[i] << endl;
 
  166         if(JustPerformLocToGloMap)
 
  168             int ncoeffs = 
m_f->m_exp[0]->GetNcoeffs();
 
  170                          C0ProjectExp[processFields[i]]->UpdateCoeffs(),1);
 
  171             C0ProjectExp[processFields[i]]->LocalToGlobal();
 
  172             C0ProjectExp[processFields[i]]->GlobalToLocal();
 
  173             Vmath::Vcopy(ncoeffs,C0ProjectExp[processFields[i]]->GetCoeffs(),1,
 
  174                          m_f->m_exp[processFields[i]]->UpdateCoeffs(),1);
 
  180                 int dim = 
m_f->m_graph->GetSpaceDimension(); 
 
  181                 int npoints = 
m_f->m_exp[0]->GetNpoints();
 
  183                 lambda = 2*M_PI/lambda;
 
  184                 lambda = lambda*lambda; 
 
  188                     cout << 
"Setting up Helmholtz smoother with lambda = " << lambda << endl;
 
  196                 for(
int j =0; j < dim; ++j)
 
  201                 C0ProjectExp[processFields[i]]->BwdTrans(
m_f->m_exp[processFields[i]]->GetCoeffs(),
 
  202                                                      m_f->m_exp[processFields[i]]->UpdatePhys());
 
  204                 Vmath::Smul(npoints,-lambda,
m_f->m_exp[processFields[i]]->GetPhys(),1,
 
  213                 C0ProjectExp[processFields[i]]->LinearAdvectionDiffusionReactionSolve(Velocity,
 
  215                                                    m_f->m_exp[processFields[i]]->UpdateCoeffs(),
 
  220                 C0ProjectExp[processFields[i]]->BwdTrans(
m_f->m_exp[processFields[i]]->GetCoeffs(),
 
  221                                                      m_f->m_exp[processFields[i]]->UpdatePhys());
 
  222                 C0ProjectExp[processFields[i]]->FwdTrans(
m_f->m_exp[processFields[i]]->GetPhys(),
 
  223                                        m_f->m_exp[processFields[i]]->UpdateCoeffs());
 
  229     std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
 
  230         = 
m_f->m_exp[0]->GetFieldDefinitions();
 
  232     std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
 
  234     for(
int i = 0; i < nfields; ++i)
 
  236         for (
int j = 0; j < FieldDef.size(); ++j)
 
  238             FieldDef[j]->m_fields.push_back(
m_f->m_fielddef[0]->m_fields[i]);
 
  239             m_f->m_exp[i]->AppendFieldData(FieldDef[j], FieldData[j]);
 
  243     m_f->m_fielddef = FieldDef;
 
  244     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. 
 
std::map< ConstFactorType, NekDouble > ConstFactorMap
 
FieldSharedPtr m_f
Field object. 
 
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y. 
 
boost::shared_ptr< Field > FieldSharedPtr
 
Represents a command-line configuration option. 
 
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
 
ModuleFactory & GetModuleFactory()
 
Abstract base class for processing modules. 
 
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.