Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Nektar::FieldUtils::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::FieldUtils::ProcessNumModes:
Inheritance graph
[legend]
Collaboration diagram for Nektar::FieldUtils::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::FieldUtils::ProcessModule
 ProcessModule ()
 
 ProcessModule (FieldSharedPtr p_f)
 
- Public Member Functions inherited from Nektar::FieldUtils::Module
FIELD_UTILS_EXPORT Module (FieldSharedPtr p_f)
 
FIELD_UTILS_EXPORT void RegisterConfig (string key, string value)
 Register a configuration option with a module. More...
 
FIELD_UTILS_EXPORT void PrintConfig ()
 Print out all configuration options for a module. More...
 
FIELD_UTILS_EXPORT void SetDefaults ()
 Sets default configuration options for those which have not been set. More...
 
FIELD_UTILS_EXPORT bool GetRequireEquiSpaced (void)
 
FIELD_UTILS_EXPORT void SetRequireEquiSpaced (bool pVal)
 
FIELD_UTILS_EXPORT void EvaluateTriFieldAtEquiSpacedPts (LocalRegions::ExpansionSharedPtr &exp, const Array< OneD, const NekDouble > &infield, Array< OneD, NekDouble > &outfield)
 

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::FieldUtils::Module
 Module ()
 
- Protected Attributes inherited from Nektar::FieldUtils::Module
FieldSharedPtr m_f
 Field object. More...
 
map< string, ConfigOptionm_config
 List of configuration values. More...
 
bool m_requireEquiSpaced
 

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::FieldUtils::ProcessNumModes::ProcessNumModes ( FieldSharedPtr  f)

Definition at line 57 of file ProcessNumModes.cpp.

Nektar::FieldUtils::ProcessNumModes::~ProcessNumModes ( )
virtual

Definition at line 61 of file ProcessNumModes.cpp.

62 {
63 }

Member Function Documentation

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

Creates an instance of this class.

Definition at line 53 of file ProcessNumModes.h.

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

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

Implements Nektar::FieldUtils::Module.

Definition at line 65 of file ProcessNumModes.h.

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

Write mesh to output file.

Implements Nektar::FieldUtils::Module.

Definition at line 65 of file ProcessNumModes.cpp.

References Vmath::Fill(), Nektar::iterator, Nektar::FieldUtils::Module::m_f, class_topology::P, and Vmath::Vcopy().

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

Member Data Documentation

ModuleKey Nektar::FieldUtils::ProcessNumModes::className
static
Initial value:
=
ModuleKey(eProcessModule, "nummodes"),
"Computes number of modes in each direction for each element.")

Definition at line 57 of file ProcessNumModes.h.