Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Nektar::Utilities::ProcessNumModes Class Reference

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

#include <ProcessNumModes.h>

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

Public Member Functions

 ProcessNumModes (FieldSharedPtr f)
 
virtual ~ProcessNumModes ()
 
virtual void Process (po::variables_map &vm)
 Write mesh to output file. More...
 
virtual std::string GetModuleName ()
 
- 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 (std::string key, std::string value)
 
void PrintConfig ()
 
void SetDefaults ()
 
MeshSharedPtr GetMesh ()
 
virtual void ProcessVertices ()
 Extract element vertices. More...
 
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...
 
virtual void ClearElementLinks ()
 

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 ()
 
void ReorderPrisms (PerMap &perFaces)
 Reorder node IDs so that prisms and tetrahedra are aligned correctly. More...
 
void PrismLines (int prism, PerMap &perFaces, std::set< int > &prismsDone, std::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...
 
std::map< std::string,
ConfigOption
m_config
 List of configuration values. More...
 

Detailed Description

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

Definition at line 49 of file ProcessNumModes.h.

Constructor & Destructor Documentation

Nektar::Utilities::ProcessNumModes::ProcessNumModes ( FieldSharedPtr  f)

Definition at line 56 of file ProcessNumModes.cpp.

Nektar::Utilities::ProcessNumModes::~ProcessNumModes ( )
virtual

Definition at line 60 of file ProcessNumModes.cpp.

61 {
62 }

Member Function Documentation

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

Creates an instance of this class.

Definition at line 53 of file ProcessNumModes.h.

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

53  {
55  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
virtual std::string Nektar::Utilities::ProcessNumModes::GetModuleName ( )
inlinevirtual

Implements Nektar::Utilities::Module.

Definition at line 64 of file ProcessNumModes.h.

65  {
66  return "ProcessNumModes";
67  }
void Nektar::Utilities::ProcessNumModes::Process ( po::variables_map &  vm)
virtual

Write mesh to output file.

Implements Nektar::Utilities::Module.

Definition at line 64 of file ProcessNumModes.cpp.

References Vmath::Fill(), Nektar::iterator, and Nektar::Utilities::Module::m_f.

65 {
66  if (m_f->m_verbose)
67  {
68  if(m_f->m_comm->GetRank() == 0)
69  {
70  cout << "ProcessNumModes: Calculating number of modes..." << endl;
71  }
72  }
73 
74  int i, j, s;
75  int expdim = m_f->m_graph->GetMeshDimension();
76  int nfields = m_f->m_fielddef[0]->m_fields.size();
77  int addfields = expdim;
78  int npoints = m_f->m_exp[0]->GetNpoints();
79  Array<OneD, Array<OneD, NekDouble> > outfield(addfields);
80 
81  int nstrips;
82 
83  m_f->m_session->LoadParameter("Strip_Z", nstrips, 1);
84 
85  m_f->m_exp.resize(nfields * nstrips);
86 
87  for (i = 0; i < addfields; ++i)
88  {
89  outfield[i] = Array<OneD, NekDouble>(npoints);
90  }
91 
92  vector<MultiRegions::ExpListSharedPtr> Exp(nstrips * addfields);
93 
94  int nExp, nq, offset;
95  nExp = m_f->m_exp[0]->GetExpSize();
96 
97  for (int n = 0; n < nExp; n++)
98  {
99  offset = m_f->m_exp[0]->GetPhys_Offset(n);
100  nq = m_f->m_exp[0]->GetExp(n)->GetTotPoints();
101 
102  for (i = 0; i < expdim; i++)
103  {
104  int P = m_f->m_exp[0]->GetExp(n)->GetBasis(i)->GetNumModes();
105  Array<OneD, NekDouble> result = outfield[i] + offset;
106  Vmath::Fill(nq, 1.0 * P, result, 1);
107  }
108  }
109 
110  for (s = 0; s < nstrips; ++s)
111  {
112  for (i = 0; i < addfields; ++i)
113  {
114  int n = s * addfields + i;
115  Exp[n] =
116  m_f->AppendExpList(m_f->m_fielddef[0]->m_numHomogeneousDir);
117  Exp[n]->UpdatePhys() = outfield[i];
118  Exp[n]->FwdTrans_IterPerExp(outfield[i], Exp[n]->UpdateCoeffs());
119  }
120  }
121 
123  for (s = 0; s < nstrips; ++s)
124  {
125  for (i = 0; i < addfields; ++i)
126  {
127  it = m_f->m_exp.begin() + s * (nfields + addfields) + nfields + i;
128  m_f->m_exp.insert(it, Exp[s * addfields + i]);
129  }
130  }
131 
132  vector<string> outname;
133  outname.push_back("P1");
134  if (addfields >= 2)
135  {
136  outname.push_back("P2");
137  }
138 
139  if (addfields == 3)
140  {
141  outname.push_back("P3");
142  }
143 
144  std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
145  m_f->m_exp[0]->GetFieldDefinitions();
146  std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
147 
148  // homogeneous strip variant
149  for (s = 0; s < nstrips; ++s)
150  {
151  for (j = 0; j < nfields + addfields; ++j)
152  {
153  for (i = 0; i < FieldDef.size() / nstrips; ++i)
154  {
155  int n = s * FieldDef.size() / nstrips + i;
156 
157  if (j >= nfields)
158  {
159  FieldDef[n]->m_fields.push_back(outname[j - nfields]);
160  }
161  else
162  {
163  FieldDef[n]->m_fields.push_back(
164  m_f->m_fielddef[0]->m_fields[j]);
165  }
166 
167  m_f->m_exp[s * (nfields + addfields) + j]->AppendFieldData(
168  FieldDef[n], FieldData[n]);
169  }
170  }
171  }
172 
173  m_f->m_fielddef = FieldDef;
174  m_f->m_data = FieldData;
175 }
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.cpp:46
FieldSharedPtr m_f
Field object.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator

Member Data Documentation

ModuleKey Nektar::Utilities::ProcessNumModes::className
static
Initial value:
=
"Computes number of modes in each direction for each element.")

Definition at line 56 of file ProcessNumModes.h.