Nektar++
FilterFieldConvert.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: FilterFieldConvert.h
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: Base clase for filters performing operations on samples
32 // of the field.
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_SOLVERUTILS_FILTERS_FILTERFIELDCONVERT_H
37 #define NEKTAR_SOLVERUTILS_FILTERS_FILTERFIELDCONVERT_H
38 
39 #include <boost/core/ignore_unused.hpp>
40 
41 #include <FieldUtils/Module.h>
43 
44 using namespace Nektar::FieldUtils;
45 
46 namespace Nektar
47 {
48 namespace SolverUtils
49 {
50 class FilterFieldConvert : public Filter
51 {
52 public:
53  friend class MemoryManager<FilterFieldConvert>;
54 
55  /// Creates an instance of this class
58  const std::weak_ptr<EquationSystem> &pEquation,
59  const std::map<std::string, std::string> &pParams)
60  {
63  pSession, pEquation, pParams);
64  return p;
65  }
66 
67  /// Name of the class
68  static std::string className;
69 
72  const std::weak_ptr<EquationSystem> &pEquation,
73  const ParamMap &pParams);
75 
76 protected:
77  SOLVER_UTILS_EXPORT virtual void v_Initialise(
79  const NekDouble &time) override;
80  SOLVER_UTILS_EXPORT virtual void v_FillVariablesName(
82  SOLVER_UTILS_EXPORT virtual void v_Update(
84  const NekDouble &time) override;
85  SOLVER_UTILS_EXPORT virtual void v_Finalise(
87  const NekDouble &time) override;
88  SOLVER_UTILS_EXPORT virtual void v_ProcessSample(
90  std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
91  const NekDouble &time);
94  const NekDouble &time)
95  {
96  boost::ignore_unused(pFields, time);
97  // Do nothing by default
98  }
100  {
101  return 1.0;
102  }
103  SOLVER_UTILS_EXPORT virtual std::string v_GetFileSuffix()
104  {
105  return "_fc";
106  }
107 
108  void OutputField(
110  int dump = -1);
111 
112  SOLVER_UTILS_EXPORT virtual bool v_IsTimeDependent() override;
113 
114  void CreateModules(std::vector<std::string> &modcmds);
115 
116  void CreateFields(
118 
119  void CheckModules(std::vector<ModuleSharedPtr> &modules);
120 
121  unsigned int m_numSamples;
122  unsigned int m_outputFrequency;
123  unsigned int m_sampleFrequency;
124  std::string m_outputFile;
125  std::string m_restartFile;
126  unsigned int m_index;
127  unsigned int m_outputIndex;
128 
129  // Phase sample parameters
135 
136  std::vector<ModuleSharedPtr> m_modules;
138  std::vector<Array<OneD, NekDouble>> m_outFields;
139  std::vector<std::string> m_variables;
141  po::variables_map m_vm;
142 };
143 } // namespace SolverUtils
144 } // namespace Nektar
145 
146 #endif /* NEKTAR_SOLVERUTILS_FILTERS_FILTERFIELDCONVERT_H */
void CheckModules(vector< ModuleSharedPtr > &modules)
#define SOLVER_UTILS_EXPORT
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
static std::string className
Name of the class.
virtual SOLVER_UTILS_EXPORT void v_PrepareOutput(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
static FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const std::map< std::string, std::string > &pParams)
Creates an instance of this class.
LibUtilities::FieldMetaDataMap m_fieldMetaData
std::vector< Array< OneD, NekDouble > > m_outFields
virtual SOLVER_UTILS_EXPORT NekDouble v_GetScale()
virtual SOLVER_UTILS_EXPORT std::string v_GetFileSuffix()
std::vector< ModuleSharedPtr > m_modules
std::map< std::string, std::string > ParamMap
Definition: Filter.h:67
std::shared_ptr< Field > FieldSharedPtr
Definition: Field.hpp:991
std::map< std::string, std::string > FieldMetaDataMap
Definition: FieldIO.h:52
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Filter > FilterSharedPtr
A shared pointer to a Driver object.
Definition: Filter.h:50
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble