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 
42 #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:
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  {
62  ::AllocateSharedPtr(pSession, pEquation, pParams);
63  return p;
64  }
65 
66  ///Name of the class
67  static std::string className;
68 
71  const std::weak_ptr<EquationSystem> &pEquation,
72  const ParamMap &pParams);
74 
75 protected:
76  SOLVER_UTILS_EXPORT virtual void v_Initialise(
78  const NekDouble &time);
79  SOLVER_UTILS_EXPORT virtual void v_FillVariablesName(
81  SOLVER_UTILS_EXPORT virtual void v_Update(
83  const NekDouble &time);
84  SOLVER_UTILS_EXPORT virtual void v_Finalise(
86  const NekDouble &time);
87  SOLVER_UTILS_EXPORT virtual void v_ProcessSample(
89  std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
90  const NekDouble &time);
93  const NekDouble &time)
94  {
95  boost::ignore_unused(pFields, time);
96  // Do nothing by default
97  }
99  {
100  return 1.0;
101  }
102  SOLVER_UTILS_EXPORT virtual std::string v_GetFileSuffix()
103  {
104  return "_fc";
105  }
106 
107  void OutputField(
109  int dump = -1);
110 
111  SOLVER_UTILS_EXPORT virtual bool v_IsTimeDependent();
112 
113  void CreateModules(std::vector<std::string> &modcmds);
114 
115  void CreateFields(
117 
118  void CheckModules(std::vector<ModuleSharedPtr> &modules);
119 
120  unsigned int m_numSamples;
121  unsigned int m_outputFrequency;
122  unsigned int m_sampleFrequency;
123  std::string m_outputFile;
124  std::string m_restartFile;
125  unsigned int m_index;
126  unsigned int m_outputIndex;
127 
128  // Phase sample parameters
134 
135  std::vector<ModuleSharedPtr> m_modules;
137  std::vector<Array<OneD, NekDouble> > m_outFields;
138  std::vector<std::string> m_variables;
140 };
141 }
142 }
143 
144 #endif /* NEKTAR_SOLVERUTILS_FILTERS_FILTERFIELDCONVERT_H */
std::shared_ptr< Filter > FilterSharedPtr
A shared pointer to a Driver object.
Definition: Filter.h:50
LibUtilities::FieldMetaDataMap m_fieldMetaData
static std::string className
Name of the class.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
std::vector< Array< OneD, NekDouble > > m_outFields
std::shared_ptr< Field > FieldSharedPtr
Definition: Field.hpp:762
std::map< std::string, std::string > FieldMetaDataMap
Definition: FieldIO.h:52
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.
virtual SOLVER_UTILS_EXPORT std::string v_GetFileSuffix()
virtual SOLVER_UTILS_EXPORT NekDouble v_GetScale()
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
double NekDouble
std::map< std::string, std::string > ParamMap
Definition: Filter.h:68
#define SOLVER_UTILS_EXPORT
std::vector< ModuleSharedPtr > m_modules
void CheckModules(vector< ModuleSharedPtr > &modules)
virtual SOLVER_UTILS_EXPORT void v_PrepareOutput(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
std::shared_ptr< SessionReader > SessionReaderSharedPtr