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::ProcessJacobianEnergy Class Reference

This processing module scales the input fld file. More...

#include <ProcessJacobianEnergy.h>

Inheritance diagram for Nektar::FieldUtils::ProcessJacobianEnergy:
Inheritance graph
[legend]
Collaboration diagram for Nektar::FieldUtils::ProcessJacobianEnergy:
Collaboration graph
[legend]

Public Member Functions

 ProcessJacobianEnergy (FieldSharedPtr f)
 
virtual ~ProcessJacobianEnergy ()
 
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 scales the input fld file.

Definition at line 47 of file ProcessJacobianEnergy.h.

Constructor & Destructor Documentation

Nektar::FieldUtils::ProcessJacobianEnergy::ProcessJacobianEnergy ( FieldSharedPtr  f)

Definition at line 56 of file ProcessJacobianEnergy.cpp.

References Nektar::FieldUtils::Module::m_config.

57  : ProcessModule(f)
58 {
59  m_config["topmodes"] =
60  ConfigOption(false, "1", "how many top modes to keep ");
61 }
map< string, ConfigOption > m_config
List of configuration values.
Nektar::FieldUtils::ProcessJacobianEnergy::~ProcessJacobianEnergy ( )
virtual

Definition at line 63 of file ProcessJacobianEnergy.cpp.

64 {
65 }

Member Function Documentation

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

Creates an instance of this class.

Definition at line 51 of file ProcessJacobianEnergy.h.

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

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

Implements Nektar::FieldUtils::Module.

Definition at line 63 of file ProcessJacobianEnergy.h.

64  {
65  return "ProcessJacobianEnergy";
66  }
void Nektar::FieldUtils::ProcessJacobianEnergy::Process ( po::variables_map &  vm)
virtual

Write mesh to output file.

Implements Nektar::FieldUtils::Module.

Definition at line 67 of file ProcessJacobianEnergy.cpp.

References Nektar::SpatialDomains::eDeformed, Nektar::SpatialDomains::eRegular, Vmath::Fill(), Nektar::FieldUtils::Module::m_f, Vmath::Vcopy(), Vmath::Vmax(), and Vmath::Vmin().

68 {
69  if (m_f->m_verbose)
70  {
71  if (m_f->m_comm->TreatAsRankZero())
72  {
73  cout << "ProcessJacobianEnergy: Processing Jacobian..." << endl;
74  }
75  }
76 
77  Array<OneD, NekDouble> phys = m_f->m_exp[0]->UpdatePhys();
78  Array<OneD, NekDouble> coeffs = m_f->m_exp[0]->UpdateCoeffs();
79  Array<OneD, NekDouble> tmp, tmp1;
80 
81  for (int i = 0; i < m_f->m_exp[0]->GetExpSize(); ++i)
82  {
83  // copy Jacobian into field
84  StdRegions::StdExpansionSharedPtr Elmt = m_f->m_exp[0]->GetExp(i);
85 
86  int ncoeffs = Elmt->GetNcoeffs();
87  int nquad = Elmt->GetTotPoints();
88  int coeffoffset = m_f->m_exp[0]->GetCoeff_Offset(i);
89  Array<OneD, NekDouble> coeffs1(ncoeffs);
90  Array<OneD, const NekDouble> Jac =
91  Elmt->GetMetricInfo()->GetJac(Elmt->GetPointsKeys());
92  if (Elmt->GetMetricInfo()->GetGtype() == SpatialDomains::eRegular)
93  {
94  Vmath::Fill(nquad, Jac[0], phys, 1);
95  }
96  else
97  {
98  Vmath::Vcopy(nquad, Jac, 1, phys, 1);
99  }
100 
101  if (Elmt->GetMetricInfo()->GetGtype() == SpatialDomains::eDeformed)
102  {
103  NekDouble jacmax = Vmath::Vmax(nquad, Jac, 1);
104  NekDouble jacmin = Vmath::Vmin(nquad, Jac, 1);
105 
106  NekDouble jacmeasure = jacmax / jacmin - 1.0;
107  Vmath::Fill(nquad, jacmeasure, phys, 1);
108  }
109  else
110  {
111  Vmath::Fill(nquad, 0.0, phys, 1);
112  }
113 
114  Elmt->FwdTrans(phys, tmp = coeffs + coeffoffset);
115  }
116 
117  std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
118  m_f->m_exp[0]->GetFieldDefinitions();
119  std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
120 
121  for (int i = 0; i < FieldDef.size(); ++i)
122  {
123  FieldDef[i]->m_fields.push_back("JacobianEnergy");
124  m_f->m_exp[0]->AppendFieldData(FieldDef[i], FieldData[i]);
125  }
126 
127  m_f->m_fielddef = FieldDef;
128  m_f->m_data = FieldData;
129 }
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
Definition: Vmath.cpp:779
T Vmin(int n, const T *x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min.
Definition: Vmath.cpp:871
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.cpp:46
double NekDouble
Geometry is straight-sided with constant geometric factors.
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061
Geometry is curved or has non-constant factors.
FieldSharedPtr m_f
Field object.

Member Data Documentation

ModuleKey Nektar::FieldUtils::ProcessJacobianEnergy::className
static
Initial value:
=
ModuleKey(eProcessModule, "jacobianenergy"),
"Show high frequency energy of Jacobian.")

Definition at line 55 of file ProcessJacobianEnergy.h.