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

This processing module replaces all expansions by a single plane from 3DH1D fields, defined by the parameter planeid. More...

#include <ProcessHomogeneousPlane.h>

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

Public Member Functions

 ProcessHomogeneousPlane (FieldSharedPtr f)
 
virtual ~ProcessHomogeneousPlane ()
 
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 replaces all expansions by a single plane from 3DH1D fields, defined by the parameter planeid.

Definition at line 50 of file ProcessHomogeneousPlane.h.

Constructor & Destructor Documentation

Nektar::FieldUtils::ProcessHomogeneousPlane::ProcessHomogeneousPlane ( FieldSharedPtr  f)

Definition at line 57 of file ProcessHomogeneousPlane.cpp.

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

58  : ProcessModule(f)
59 {
60  m_config["planeid"] = ConfigOption(false, "NotSet", "plane id to extract");
61  m_config["wavespace"] =
62  ConfigOption(true, "NotSet", "Extract plane in Fourier space");
63 }
map< string, ConfigOption > m_config
List of configuration values.
Nektar::FieldUtils::ProcessHomogeneousPlane::~ProcessHomogeneousPlane ( )
virtual

Definition at line 65 of file ProcessHomogeneousPlane.cpp.

66 {
67 }

Member Function Documentation

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

Creates an instance of this class.

Definition at line 54 of file ProcessHomogeneousPlane.h.

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

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

Implements Nektar::FieldUtils::Module.

Reimplemented in Nektar::FieldUtils::ProcessMeanMode.

Definition at line 66 of file ProcessHomogeneousPlane.h.

67  {
68  return "ProcessScalGrad";
69  }
void Nektar::FieldUtils::ProcessHomogeneousPlane::Process ( po::variables_map &  vm)
virtual

Write mesh to output file.

Implements Nektar::FieldUtils::Module.

Reimplemented in Nektar::FieldUtils::ProcessMeanMode.

Definition at line 69 of file ProcessHomogeneousPlane.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, Nektar::FieldUtils::Module::m_config, and Nektar::FieldUtils::Module::m_f.

Referenced by Nektar::FieldUtils::ProcessMeanMode::Process().

70 {
71  if (m_f->m_verbose)
72  {
73  if (m_f->m_comm->TreatAsRankZero())
74  {
75  cout << "ProcessHomogeneousPlane: Extracting plane..." << endl;
76  }
77  }
78 
79  if ((m_f->m_fielddef[0]->m_numHomogeneousDir) != 1)
80  {
81  ASSERTL0(false,
82  "ProcessHomogeneousPlane only works for Homogeneous1D.");
83  }
84 
85  ASSERTL0(m_config["planeid"].m_beenSet,
86  "Missing parameter planeid for ProcessHomogeneousPlane");
87 
88  int planeid = m_config["planeid"].as<int>();
89  int nfields = m_f->m_fielddef[0]->m_fields.size();
90 
91  int nstrips;
92  m_f->m_session->LoadParameter("Strip_Z", nstrips, 1);
93 
94  // Look for correct plane (because of parallel case)
95  int plane = -1;
96  for (int i = 0; i < m_f->m_fielddef[0]->m_homogeneousZIDs.size(); ++i)
97  {
98  if (m_f->m_fielddef[0]->m_homogeneousZIDs[i] == planeid)
99  {
100  plane = i;
101  }
102  }
103 
104  if (plane != -1)
105  {
106  for (int s = 0; s < nstrips; ++s)
107  {
108  for (int i = 0; i < nfields; ++i)
109  {
110  int n = s * nfields + i;
111  m_f->m_exp[n] = m_f->m_exp[n]->GetPlane(plane);
112 
113  if (m_config["wavespace"].m_beenSet)
114  {
115  m_f->m_exp[n]->BwdTrans(m_f->m_exp[n]->GetCoeffs(),
116  m_f->m_exp[n]->UpdatePhys());
117  }
118  else
119  {
120  m_f->m_exp[n]->FwdTrans(m_f->m_exp[n]->GetPhys(),
121  m_f->m_exp[n]->UpdateCoeffs());
122  }
123  }
124  }
125  std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
126  m_f->m_exp[0]->GetFieldDefinitions();
127  std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
128 
129  for (int s = 0; s < nstrips; ++s)
130  {
131  for (int j = 0; j < nfields; ++j)
132  {
133  for (int i = 0; i < FieldDef.size() / nstrips; ++i)
134  {
135  int n = s * FieldDef.size() / nstrips + i;
136 
137  FieldDef[n]->m_fields.push_back(
138  m_f->m_fielddef[0]->m_fields[j]);
139  m_f->m_exp[s * nfields + j]->AppendFieldData(FieldDef[n],
140  FieldData[n]);
141  }
142  }
143  }
144 
145  m_f->m_fielddef = FieldDef;
146  m_f->m_data = FieldData;
147  }
148  else
149  {
150  for (int s = 0; s < nstrips; ++s)
151  {
152  for (int i = 0; i < nfields; ++i)
153  {
154  int n = s * nfields + i;
155  m_f->m_exp[n] =
157  }
158  }
159  m_f->m_fielddef =
160  std::vector<LibUtilities::FieldDefinitionsSharedPtr>();
161  m_f->m_data = std::vector<std::vector<NekDouble> >();
162  }
163 }
map< string, ConfigOption > m_config
List of configuration values.
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
FieldSharedPtr m_f
Field object.

Member Data Documentation

ModuleKey Nektar::FieldUtils::ProcessHomogeneousPlane::className
static
Initial value:
=
ModuleKey(eProcessModule, "homplane"),
"Extracts a plane from a 3DH1D expansion, requires planeid to be "
"defined.")

Definition at line 58 of file ProcessHomogeneousPlane.h.