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::FieldUtils
42{
43
44/// Converter from fld to vtk.
46{
47public:
49 ~OutputFileBase() override;
50
51protected:
52 /// Write fld to output file.
53 void v_Process(po::variables_map &vm) override;
54
55 std::string v_GetModuleName() override
56 {
57 return "OutputFileBase";
58 }
59
60 std::string v_GetModuleDescription() override
61 {
62 return "Writing file";
63 }
64
66 {
67 return eOutput;
68 }
69
70 /// Write from pts to output file.
71 virtual void v_OutputFromPts(po::variables_map &vm) = 0;
72
73 /// Write from m_exp to output file.
74 virtual void v_OutputFromExp(po::variables_map &vm) = 0;
75
76 /// Write from data to output file.
77 virtual void v_OutputFromData(po::variables_map &vm) = 0;
78
79 virtual fs::path v_GetPath([[maybe_unused]] std::string &filename,
80 [[maybe_unused]] po::variables_map &vm)
81 {
82 NEKERROR(ErrorUtil::efatal, "v_GetPath not coded");
83 return fs::path();
84 }
85 fs::path GetPath(std::string &filename, po::variables_map &vm)
86 {
87 return v_GetPath(filename, vm);
88 }
89
90 virtual fs::path v_GetFullOutName([[maybe_unused]] std::string &filename,
91 [[maybe_unused]] po::variables_map &vm)
92 {
93 NEKERROR(ErrorUtil::efatal, "v_OutputFromExp not coded");
94 return fs::path();
95 }
96 fs::path GetFullOutName(std::string &filename, po::variables_map &vm)
97 {
98 return v_GetFullOutName(filename, vm);
99 }
100
102
103private:
104 bool WriteFile(std::string &filename, po::variables_map &vm);
105
106 void ConvertExpToEquispaced(po::variables_map &vm);
107
108 void PrintErrorFromPts();
109
110 void PrintErrorFromExp();
111};
112} // namespace Nektar::FieldUtils
113
114#endif
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:202
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.
bool WriteFile(std::string &filename, po::variables_map &vm)
fs::path GetFullOutName(std::string &filename, po::variables_map &vm)
std::string v_GetModuleDescription() override
virtual fs::path v_GetPath(std::string &filename, po::variables_map &vm)
std::string v_GetModuleName() override
void ConvertExpToEquispaced(po::variables_map &vm)
ModulePriority v_GetModulePriority() override
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)
void v_Process(po::variables_map &vm) override
Write fld to output file.
Abstract base class for output modules.
Definition: Module.h:316
std::shared_ptr< Field > FieldSharedPtr
Definition: Field.hpp:990