Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
Nektar::FieldUtils::ProcessMean Class Reference

This processing module computes the mean of each field. More...

#include <ProcessMean.h>

Inheritance diagram for Nektar::FieldUtils::ProcessMean:
[legend]

Public Member Functions

 ProcessMean (FieldSharedPtr f)
 
virtual ~ProcessMean ()
 
- 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)
 
virtual ~Module ()=default
 
void Process (po::variables_map &vm)
 
std::string GetModuleName ()
 
std::string GetModuleDescription ()
 
const ConfigOptionGetConfigOption (const std::string &key) const
 
ModulePriority GetModulePriority ()
 
FIELD_UTILS_EXPORT void RegisterConfig (std::string key, std::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 void AddFile (std::string fileType, std::string fileName)
 
FIELD_UTILS_EXPORT void EvaluateTriFieldAtEquiSpacedPts (LocalRegions::ExpansionSharedPtr &exp, const Array< OneD, const NekDouble > &infield, Array< OneD, NekDouble > &outfield)
 

Static Public Member Functions

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

Static Public Attributes

static ModuleKey className
 

Protected Member Functions

virtual void v_Process (po::variables_map &vm) override
 Write mesh to output file. More...
 
virtual std::string v_GetModuleName () override
 
virtual std::string v_GetModuleDescription () override
 
virtual ModulePriority v_GetModulePriority () override
 
- Protected Member Functions inherited from Nektar::FieldUtils::Module
 Module ()
 
virtual void v_Process (po::variables_map &vm)
 
virtual std::string v_GetModuleName ()
 
virtual std::string v_GetModuleDescription ()
 
virtual ModulePriority v_GetModulePriority ()
 

Additional Inherited Members

- Public Attributes inherited from Nektar::FieldUtils::Module
FieldSharedPtr m_f
 Field object. More...
 
- Protected Attributes inherited from Nektar::FieldUtils::Module
std::map< std::string, ConfigOptionm_config
 List of configuration values. More...
 
std::set< std::string > m_allowedFiles
 List of allowed file formats. More...
 

Detailed Description

This processing module computes the mean of each field.

Definition at line 49 of file ProcessMean.h.

Constructor & Destructor Documentation

◆ ProcessMean()

Nektar::FieldUtils::ProcessMean::ProcessMean ( FieldSharedPtr  f)

Definition at line 54 of file ProcessMean.cpp.

◆ ~ProcessMean()

Nektar::FieldUtils::ProcessMean::~ProcessMean ( )
virtual

Definition at line 58 of file ProcessMean.cpp.

59{
60}

Member Function Documentation

◆ create()

static std::shared_ptr< Module > Nektar::FieldUtils::ProcessMean::create ( FieldSharedPtr  f)
inlinestatic

Creates an instance of this class.

Definition at line 53 of file ProcessMean.h.

54 {
56 }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

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

◆ v_GetModuleDescription()

virtual std::string Nektar::FieldUtils::ProcessMean::v_GetModuleDescription ( )
inlineoverrideprotectedvirtual

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 71 of file ProcessMean.h.

72 {
73 return "Evaluating mean";
74 }

◆ v_GetModuleName()

virtual std::string Nektar::FieldUtils::ProcessMean::v_GetModuleName ( )
inlineoverrideprotectedvirtual

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 66 of file ProcessMean.h.

67 {
68 return "ProcessMean";
69 }

◆ v_GetModulePriority()

virtual ModulePriority Nektar::FieldUtils::ProcessMean::v_GetModulePriority ( )
inlineoverrideprotectedvirtual

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 76 of file ProcessMean.h.

77 {
78 return eModifyExp;
79 }

References Nektar::FieldUtils::eModifyExp.

◆ v_Process()

void Nektar::FieldUtils::ProcessMean::v_Process ( po::variables_map &  vm)
overrideprotectedvirtual

Write mesh to output file.

Reimplemented from Nektar::FieldUtils::Module.

Definition at line 62 of file ProcessMean.cpp.

63{
64 m_f->SetUpExp(vm);
65
66 int nfields = m_f->m_variables.size();
67 int spacedim = m_f->m_graph->GetMeshDimension() + m_f->m_numHomogeneousDir;
68 int npoints = m_f->m_exp[0]->GetNpoints();
69
70 // Calculate volume (or area)
71 Array<OneD, NekDouble> ones(npoints, 1.0);
72 NekDouble scale = m_f->m_exp[0]->Integral(ones);
73
74 // Output volume
75 string name[3] = {"length", "area", "volume"};
76 cout << "Domain " << name[spacedim - 1] << " : " << scale << endl;
77
78 // Calculate integral and mean of each field
79 for (int i = 0; i < nfields; ++i)
80 {
81 NekDouble integral = m_f->m_exp[0]->Integral(m_f->m_exp[i]->GetPhys());
82
83 if (m_f->m_comm->GetSpaceComm()->GetRank() == 0)
84 {
85 cout << "Integral (variable " << m_f->m_variables[i]
86 << ") : " << integral << endl;
87 cout << "Mean (variable " << m_f->m_variables[i]
88 << ") : " << integral / scale << endl;
89 }
90 }
91}
FieldSharedPtr m_f
Field object.
Definition: Module.h:234
double NekDouble

References Nektar::FieldUtils::Module::m_f, and CellMLToNektar.pycml::name.

Member Data Documentation

◆ className

ModuleKey Nektar::FieldUtils::ProcessMean::className
static
Initial value:
"compute the mean of each field over the domain.")
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
Definition: ProcessMean.h:53
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:198
std::pair< ModuleType, std::string > ModuleKey
Definition: Module.h:317
ModuleFactory & GetModuleFactory()
Definition: Module.cpp:49

Definition at line 57 of file ProcessMean.h.