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

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

#include <ProcessScaleInFld.h>

Inheritance diagram for Nektar::FieldUtils::ProcessScaleInFld:
Inheritance graph
[legend]
Collaboration diagram for Nektar::FieldUtils::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::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 50 of file ProcessScaleInFld.h.

Constructor & Destructor Documentation

Nektar::FieldUtils::ProcessScaleInFld::ProcessScaleInFld ( FieldSharedPtr  f)

Definition at line 56 of file ProcessScaleInFld.cpp.

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

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

Definition at line 73 of file ProcessScaleInFld.cpp.

74 {
75 }

Member Function Documentation

static boost::shared_ptr<Module> Nektar::FieldUtils::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::FieldUtils::ProcessScaleInFld::GetModuleName ( )
inlinevirtual

Implements Nektar::FieldUtils::Module.

Definition at line 66 of file ProcessScaleInFld.h.

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

Write mesh to output file.

Implements Nektar::FieldUtils::Module.

Definition at line 77 of file ProcessScaleInFld.cpp.

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

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

Member Data Documentation

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

Definition at line 58 of file ProcessScaleInFld.h.