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
44using namespace Nektar::FieldUtils;
45
46namespace Nektar
47{
48namespace SolverUtils
49{
51{
52public:
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
76protected:
79 const NekDouble &time) override;
82 SOLVER_UTILS_EXPORT virtual void v_Update(
84 const NekDouble &time) override;
87 const NekDouble &time) override;
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 }
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 */
#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.
virtual SOLVER_UTILS_EXPORT bool v_IsTimeDependent() override
virtual SOLVER_UTILS_EXPORT void v_ProcessSample(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, std::vector< Array< OneD, NekDouble > > &fieldcoeffs, const NekDouble &time)
virtual SOLVER_UTILS_EXPORT ~FilterFieldConvert()
static std::string className
Name of the class.
void CreateFields(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields)
void CheckModules(std::vector< ModuleSharedPtr > &modules)
virtual SOLVER_UTILS_EXPORT void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
virtual SOLVER_UTILS_EXPORT void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
virtual SOLVER_UTILS_EXPORT void v_FillVariablesName(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields)
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.
SOLVER_UTILS_EXPORT FilterFieldConvert(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const ParamMap &pParams)
void CreateModules(std::vector< std::string > &modcmds)
void OutputField(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, int dump=-1)
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
virtual SOLVER_UTILS_EXPORT void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
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:53
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble