Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Nektar::Utilities::ProcessC0Projection Class Reference

This processing module calculates the Q Criterion and adds it as an extra-field to the output file. More...

#include <ProcessC0Projection.h>

Inheritance diagram for Nektar::Utilities::ProcessC0Projection:
Inheritance graph
[legend]
Collaboration diagram for Nektar::Utilities::ProcessC0Projection:
Collaboration graph
[legend]

Public Member Functions

 ProcessC0Projection (FieldSharedPtr f)
 
virtual ~ProcessC0Projection ()
 
virtual void Process (po::variables_map &vm)
 Write mesh to output file. More...
 
- Public Member Functions inherited from Nektar::Utilities::ProcessModule
 ProcessModule ()
 
 ProcessModule (FieldSharedPtr p_f)
 
 ProcessModule (MeshSharedPtr p_m)
 
- Public Member Functions inherited from Nektar::Utilities::Module
 Module (FieldSharedPtr p_f)
 
void RegisterConfig (string key, string value)
 Register a configuration option with a module. More...
 
void PrintConfig ()
 Print out all configuration options for a module. More...
 
void SetDefaults ()
 Sets default configuration options for those which have not been set. More...
 
bool GetRequireEquiSpaced (void)
 
void SetRequireEquiSpaced (bool pVal)
 
void EvaluateTriFieldAtEquiSpacedPts (LocalRegions::ExpansionSharedPtr &exp, const Array< OneD, const NekDouble > &infield, Array< OneD, NekDouble > &outfield)
 
 Module (MeshSharedPtr p_m)
 
virtual void Process ()=0
 
void RegisterConfig (string key, string value)
 
void PrintConfig ()
 
void SetDefaults ()
 
MeshSharedPtr GetMesh ()
 
virtual void ProcessVertices ()
 Extract element vertices. More...
 

Static Public Member Functions

static boost::shared_ptr< Modulecreate (FieldSharedPtr f)
 Creates an instance of this class. More...
 

Static Public Attributes

static ModuleKey className
 

Additional Inherited Members

- Protected Member Functions inherited from Nektar::Utilities::Module
 Module ()
 
virtual void ProcessEdges (bool ReprocessEdges=true)
 Extract element edges. More...
 
virtual void ProcessFaces (bool ReprocessFaces=true)
 Extract element faces. More...
 
virtual void ProcessElements ()
 Generate element IDs. More...
 
virtual void ProcessComposites ()
 Generate composites. More...
 
void ReorderPrisms (PerMap &perFaces)
 Reorder node IDs so that prisms and tetrahedra are aligned correctly. More...
 
void PrismLines (int prism, PerMap &perFaces, set< int > &prismsDone, vector< ElementSharedPtr > &line)
 
- Protected Attributes inherited from Nektar::Utilities::Module
FieldSharedPtr m_f
 Field object. More...
 
map< string, ConfigOptionm_config
 List of configuration values. More...
 
bool m_requireEquiSpaced
 
MeshSharedPtr m_mesh
 Mesh object. More...
 

Detailed Description

This processing module calculates the Q Criterion and adds it as an extra-field to the output file.

Definition at line 50 of file ProcessC0Projection.h.

Constructor & Destructor Documentation

Nektar::Utilities::ProcessC0Projection::ProcessC0Projection ( FieldSharedPtr  f)

Definition at line 55 of file ProcessC0Projection.cpp.

References Nektar::Utilities::Module::m_config.

55  : ProcessModule(f)
56 {
57  m_config["fields"] = ConfigOption(false,"All","Start field to project");
58 }
map< string, ConfigOption > m_config
List of configuration values.
Nektar::Utilities::ProcessC0Projection::~ProcessC0Projection ( )
virtual

Definition at line 60 of file ProcessC0Projection.cpp.

61 {
62 }

Member Function Documentation

static boost::shared_ptr<Module> Nektar::Utilities::ProcessC0Projection::create ( FieldSharedPtr  f)
inlinestatic

Creates an instance of this class.

Definition at line 54 of file ProcessC0Projection.h.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

55  {
57  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void Nektar::Utilities::ProcessC0Projection::Process ( po::variables_map &  vm)
virtual

Write mesh to output file.

Implements Nektar::Utilities::Module.

Definition at line 64 of file ProcessC0Projection.cpp.

References ASSERTL0, Nektar::ParseUtils::GenerateOrderedVector(), Nektar::Utilities::Module::m_config, and Nektar::Utilities::Module::m_f.

65 {
66  if (m_f->m_verbose)
67  {
68  cout << "ProcessC0Projection: Projecting field into C0 space..."
69  << endl;
70  }
71 
72  // ensure not using diagonal preconditioner since tends not to converge fo
73  // mass matrix
74  if(m_f->m_graph->GetMeshDimension() == 3)
75  {
76  if(boost::iequals(m_f->m_session->GetSolverInfo("GLOBALSYSSOLN"),
77  "IterativeStaticCond"))
78  {
79  if(boost::iequals(m_f->m_session->GetSolverInfo("PRECONDITIONER"),
80  "Diagonal"))
81  {
82  m_f->m_session->SetSolverInfo("PRECONDITIONER","LowEnergyBlock");
83  }
84  if(boost::iequals(m_f->m_session->GetSolverInfo("PRECONDITIONER"),
85  "FullLinearSpaceWithDiagonal"))
86  {
87  m_f->m_session->SetSolverInfo("PRECONDITIONER","FullLinearSpaceWithLowEnergyBlock");
88  }
89 
90  if(m_f->m_verbose)
91  {
92  cout << "Resetting diagonal precondition to low energy block " << endl;;
93  }
94  }
95  }
96 
97 
98  // generate an C0 expansion field with no boundary conditions.
99  bool savedef = m_f->m_declareExpansionAsContField;
100  m_f->m_declareExpansionAsContField = true;
101  MultiRegions::ExpListSharedPtr C0ProjectExp =
102  m_f->AppendExpList(m_f->m_fielddef[0]->m_numHomogeneousDir,
103  "DefaultVar",true);
104  m_f->m_declareExpansionAsContField = savedef;
105 
106  int nfields = m_f->m_exp.size();
107 
108  string fields = m_config["fields"].as<string>();
109  vector<unsigned int> processFields;
110 
111  if(fields.compare("All") == 0)
112  {
113  for(int i = 0; i < nfields; ++i)
114  {
115  processFields.push_back(i);
116  }
117  }
118  else
119  {
121  processFields),
122  "Failed to interpret field string in C0Projection");
123  }
124 
125  for (int i = 0; i < processFields.size(); ++i)
126  {
127  ASSERTL0(processFields[i] < nfields,
128  "Attempt to process field that is larger than then number of "
129  "fields available");
130 
131  if (m_f->m_verbose)
132  {
133  cout << "\t Processing field: " << processFields[i] << endl;
134  }
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());
139  }
140 
141  // reset FieldDef in case of serial input and parallel output
142  std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
143  = m_f->m_exp[0]->GetFieldDefinitions();
144  // reset up FieldData with new values before projecting
145  std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
146 
147  for(int i = 0; i < nfields; ++i)
148  {
149  for (int j = 0; j < FieldDef.size(); ++j)
150  {
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]);
153  }
154  }
155 
156  m_f->m_fielddef = FieldDef;
157  m_f->m_data = FieldData;
158 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
static bool GenerateOrderedVector(const char *const str, std::vector< unsigned int > &vec)
Definition: ParseUtils.hpp:96
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.
Definition: ExpList.h:1340

Member Data Documentation

ModuleKey Nektar::Utilities::ProcessC0Projection::className
static
Initial value:

Definition at line 58 of file ProcessC0Projection.h.