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

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

#include <ProcessScaleInFld.h>

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

Public Member Functions

 ProcessScaleInFld (FieldSharedPtr f)
 
virtual ~ProcessScaleInFld ()
 
virtual void Process (po::variables_map &vm)
 Write mesh to output file. More...
 
- 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 (string key, 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, set< int > &prismsDone, 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...
 

Detailed Description

This processing module scales the input fld file.

Definition at line 50 of file ProcessScaleInFld.h.

Constructor & Destructor Documentation

Nektar::Utilities::ProcessScaleInFld::ProcessScaleInFld ( FieldSharedPtr  f)

Definition at line 55 of file ProcessScaleInFld.cpp.

References ASSERTL0, and Nektar::Utilities::Module::m_config.

55  : ProcessModule(f)
56 {
57  if((f->m_inputfiles.count("fld") == 0) &&
58  (f->m_inputfiles.count("rst") == 0) &&
59  (f->m_inputfiles.count("chk") == 0))
60  {
61  cout << "A fld, chk or rst input file must be specified for the "
62  "scaleinputfld module" << endl;
63  exit(3);
64  }
65 
66  m_config["scale"] = ConfigOption(false,"NotSet","scale factor");
67  ASSERTL0(m_config["scale"].as<string>().compare("NotSet") != 0,
68  "scaleinputfld: Need to specify a sacle factor");
69 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
map< string, ConfigOption > m_config
List of configuration values.
Nektar::Utilities::ProcessScaleInFld::~ProcessScaleInFld ( )
virtual

Definition at line 71 of file ProcessScaleInFld.cpp.

72 {
73 }

Member Function Documentation

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

Creates an instance of this class.

Definition at line 54 of file ProcessScaleInFld.h.

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

55  {
57  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void Nektar::Utilities::ProcessScaleInFld::Process ( po::variables_map &  vm)
virtual

Write mesh to output file.

Implements Nektar::Utilities::Module.

Definition at line 75 of file ProcessScaleInFld.cpp.

References ASSERTL0, Nektar::Utilities::Module::m_config, Nektar::Utilities::Module::m_f, and Vmath::Smul().

76 {
77 
78  ASSERTL0(m_f->m_data.size() != 0,"No input data defined");
79 
80  string scalestr = m_config["scale"].as<string>();
81  NekDouble scale = boost::lexical_cast<NekDouble>(scalestr);
82 
83  if (m_f->m_verbose)
84  {
85  cout << "ProcessScaleInFld: Rescaling input fld by factor " << scale << endl;
86  }
87 
88  for(int i = 0; i < m_f->m_data.size(); ++i)
89  {
90  int datalen = m_f->m_data[i].size();
91 
92  Vmath::Smul(datalen, scale, &(m_f->m_data[i][0]), 1,
93  &(m_f->m_data[i][0]), 1);
94  }
95 
96  if(m_f->m_exp.size())// expansiosn are defined reload field
97  {
98  int nfields = m_f->m_fielddef[0]->m_fields.size();
99 
100  // import basic field again in case of rescaling
101  for (int j = 0; j < nfields; ++j)
102  {
103  for (int i = 0; i < m_f->m_data.size(); ++i)
104  {
105  m_f->m_exp[j]->ExtractDataToCoeffs(
106  m_f->m_fielddef[i],
107  m_f->m_data[i],
108  m_f->m_fielddef[i]->m_fields[j],
109  m_f->m_exp[j]->UpdateCoeffs());
110  }
111  }
112  }
113 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
map< string, ConfigOption > m_config
List of configuration values.
FieldSharedPtr m_f
Field object.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Definition: Vmath.cpp:199
double NekDouble

Member Data Documentation

ModuleKey Nektar::Utilities::ProcessScaleInFld::className
static
Initial value:
=
ModuleKey(eProcessModule, "scaleinputfld"),
ProcessScaleInFld::create, "rescale input field by a constant factor.")

Definition at line 58 of file ProcessScaleInFld.h.