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 <FieldUtils/Module.h>
41
42using namespace Nektar::FieldUtils;
43
44namespace Nektar::SolverUtils
45{
47{
48public:
50
51 /// Creates an instance of this class
54 const std::shared_ptr<EquationSystem> &pEquation,
55 const std::map<std::string, std::string> &pParams)
56 {
59 pSession, pEquation, pParams);
60 return p;
61 }
62
63 /// Name of the class
64 static std::string className;
65
68 const std::shared_ptr<EquationSystem> &pEquation,
69 const ParamMap &pParams);
71
72protected:
75 const NekDouble &time) override;
80 const NekDouble &time) override;
83 const NekDouble &time) override;
86 std::vector<Array<OneD, NekDouble>> &fieldcoeffs,
87 const NekDouble &time);
90 &pFields,
91 [[maybe_unused]] const NekDouble &time)
92 {
93 }
95 {
96 return 1.0;
97 }
99 {
100 return "_fc";
101 }
102
103 void OutputField(
105 int dump = -1);
106
108
109 void CreateModules(std::vector<std::string> &modcmds);
110
111 void CreateFields(
113
114 void CheckModules(std::vector<ModuleSharedPtr> &modules);
115
116 unsigned int m_numSamples;
117 unsigned int m_outputFrequency;
118 unsigned int m_sampleFrequency;
119 std::string m_outputFile;
120 std::string m_restartFile;
121 unsigned int m_index;
122 unsigned int m_outputIndex;
123
124 // Phase sample parameters
130 // Time when we start writing checkfiles
132
133 std::vector<ModuleSharedPtr> m_modules;
135 std::vector<Array<OneD, NekDouble>> m_outFields;
136 std::vector<std::string> m_variables;
138 po::variables_map m_vm;
139};
140} // namespace Nektar::SolverUtils
141
142#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.
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)
static std::string className
Name of the class.
void CreateFields(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields)
void CheckModules(std::vector< ModuleSharedPtr > &modules)
SOLVER_UTILS_EXPORT void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
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)
SOLVER_UTILS_EXPORT ~FilterFieldConvert() override
void CreateModules(std::vector< std::string > &modcmds)
static FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::shared_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::shared_ptr< EquationSystem > &pEquation, const ParamMap &pParams)
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
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:65
std::shared_ptr< Field > FieldSharedPtr
Definition: Field.hpp:1026
std::map< std::string, std::string > FieldMetaDataMap
Definition: FieldIO.h:50
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Filter > FilterSharedPtr
A shared pointer to a Driver object.
Definition: Filter.h:51
double NekDouble