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...
 
virtual std::string GetModuleName ()
 
- 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 (std::string key, std::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, std::set< int > &prismsDone, std::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...
 
std::map< std::string,
ConfigOption
m_config
 List of configuration values. 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:188
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.
virtual std::string Nektar::Utilities::ProcessScaleInFld::GetModuleName ( )
inlinevirtual

Implements Nektar::Utilities::Module.

Definition at line 66 of file ProcessScaleInFld.h.

67  {
68  return "ProcessScaleInFld";
69  }
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  ASSERTL0(m_f->m_data.size() != 0,"No input data defined");
78 
79  string scalestr = m_config["scale"].as<string>();
80  NekDouble scale = boost::lexical_cast<NekDouble>(scalestr);
81 
82  if (m_f->m_verbose)
83  {
84  if(m_f->m_comm->TreatAsRankZero())
85  {
86  cout << "ProcessScaleInFld: Rescaling input fld by factor"
87  << scale << "..." << endl;
88  }
89  }
90 
91  for(int i = 0; i < m_f->m_data.size(); ++i)
92  {
93  int datalen = m_f->m_data[i].size();
94 
95  Vmath::Smul(datalen, scale, &(m_f->m_data[i][0]), 1,
96  &(m_f->m_data[i][0]), 1);
97  }
98 
99  if(m_f->m_exp.size())// expansiosn are defined reload field
100  {
101  int nfields = m_f->m_fielddef[0]->m_fields.size();
102 
103  // import basic field again in case of rescaling
104  for (int j = 0; j < nfields; ++j)
105  {
106  for (int i = 0; i < m_f->m_data.size(); ++i)
107  {
108  m_f->m_exp[j]->ExtractDataToCoeffs(
109  m_f->m_fielddef[i],
110  m_f->m_data[i],
111  m_f->m_fielddef[i]->m_fields[j],
112  m_f->m_exp[j]->UpdateCoeffs());
113  }
114  }
115  }
116 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
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.