Nektar++
OutputFileBase.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////////////
2//
3// File: OutputFileBase.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 class for outputting to a file
32//
33////////////////////////////////////////////////////////////////////////////////
34
35#ifndef FIELDUTILS_OUTPUTFILEBASE
36#define FIELDUTILS_OUTPUTFILEBASE
37
38#include "../Module.h"
39#include <tinyxml.h>
40
41namespace Nektar
42{
43namespace FieldUtils
44{
45
46/// Converter from fld to vtk.
48{
49public:
51 virtual ~OutputFileBase();
52
53protected:
54 /// Write fld to output file.
55 virtual void v_Process(po::variables_map &vm) override;
56
57 virtual std::string v_GetModuleName() override
58 {
59 return "OutputFileBase";
60 }
61
62 virtual std::string v_GetModuleDescription() override
63 {
64 return "Writing file";
65 }
66
68 {
69 return eOutput;
70 }
71
72 /// Write from pts to output file.
73 virtual void v_OutputFromPts(po::variables_map &vm) = 0;
74
75 /// Write from m_exp to output file.
76 virtual void v_OutputFromExp(po::variables_map &vm) = 0;
77
78 /// Write from data to output file.
79 virtual void v_OutputFromData(po::variables_map &vm) = 0;
80
81 virtual fs::path v_GetPath(std::string &filename, po::variables_map &vm)
82 {
83 boost::ignore_unused(filename, vm);
84 NEKERROR(ErrorUtil::efatal, "v_GetPath not coded");
85 return fs::path();
86 }
87 fs::path GetPath(std::string &filename, po::variables_map &vm)
88 {
89 return v_GetPath(filename, vm);
90 }
91
92 virtual fs::path v_GetFullOutName(std::string &filename,
93 po::variables_map &vm)
94 {
95 boost::ignore_unused(filename, vm);
96 NEKERROR(ErrorUtil::efatal, "v_OutputFromExp not coded");
97 return fs::path();
98 }
99 fs::path GetFullOutName(std::string &filename, po::variables_map &vm)
100 {
101 return v_GetFullOutName(filename, vm);
102 }
103
105
106private:
107 bool WriteFile(std::string &filename, po::variables_map &vm);
108
109 void ConvertExpToEquispaced(po::variables_map &vm);
110
111 void PrintErrorFromPts();
112
113 void PrintErrorFromExp();
114};
115} // namespace FieldUtils
116} // namespace Nektar
117
118#endif
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:209
Converter from fld to vtk.
virtual fs::path v_GetFullOutName(std::string &filename, po::variables_map &vm)
virtual void v_OutputFromExp(po::variables_map &vm)=0
Write from m_exp to output file.
virtual std::string v_GetModuleName() override
bool WriteFile(std::string &filename, po::variables_map &vm)
fs::path GetFullOutName(std::string &filename, po::variables_map &vm)
virtual std::string v_GetModuleDescription() override
virtual fs::path v_GetPath(std::string &filename, po::variables_map &vm)
virtual ModulePriority v_GetModulePriority() override
void ConvertExpToEquispaced(po::variables_map &vm)
virtual void v_OutputFromData(po::variables_map &vm)=0
Write from data to output file.
virtual void v_OutputFromPts(po::variables_map &vm)=0
Write from pts to output file.
fs::path GetPath(std::string &filename, po::variables_map &vm)
virtual void v_Process(po::variables_map &vm) override
Write fld to output file.
Abstract base class for output modules.
Definition: Module.h:307
std::shared_ptr< Field > FieldSharedPtr
Definition: Field.hpp:991
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2