Nektar++
PtsIO.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File PtsIO.h
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2014 Kilian Lackhove
10 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
11 // Department of Aeronautics, Imperial College London (UK), and Scientific
12 // Computing and Imaging Institute, University of Utah (USA).
13 //
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Pts IO prototype definitions
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_LIB_UTILITIES_BASIC_UTILS_PTSIO_H
37 #define NEKTAR_LIB_UTILITIES_BASIC_UTILS_PTSIO_H
38 
39 #include <string>
40 #include <vector>
41 #include <memory>
42 
43 #include <tinyxml.h>
44 
46 
52 
53 
54 namespace Nektar
55 {
56 namespace LibUtilities
57 {
58 
59 typedef std::map<std::string, std::string> PtsMetaDataMap;
61 
62 class PtsIO : public FieldIOXml
63 {
64 public:
66  bool sharedFilesystem = false);
67 
69  {
70  }
71 
73  const std::string &inFile,
74  PtsFieldSharedPtr &ptsField,
75  FieldMetaDataMap &fieldmetadatamap = NullFieldMetaDataMap,
77 
78  LIB_UTILITIES_EXPORT void Write(const std::string &outFile,
79  const PtsFieldSharedPtr &ptsField,
80  const bool backup = false);
81 
82  LIB_UTILITIES_EXPORT void ImportFieldData(const std::string inFile,
83  PtsFieldSharedPtr &ptsField,
85 
86 protected:
87 
89  const std::string inFile,
90  PtsFieldSharedPtr &ptsField,
92 
93  LIB_UTILITIES_EXPORT void SetUpFieldMetaData(const std::string outname);
94 
95  LIB_UTILITIES_EXPORT virtual std::string GetFileEnding() const
96  {
97  return "pts";
98  };
99 };
100 
101 typedef std::shared_ptr<PtsIO> PtsIOSharedPtr;
102 }
103 }
104 #endif
#define LIB_UTILITIES_EXPORT
void Write(const std::string &outFile, const PtsFieldSharedPtr &ptsField, const bool backup=false)
Save a pts field to a file.
Definition: PtsIO.cpp:138
PtsIO(LibUtilities::CommSharedPtr pComm, bool sharedFilesystem=false)
Definition: PtsIO.cpp:60
virtual void v_ImportFieldData(const std::string inFile, PtsFieldSharedPtr &ptsField, DomainRangeShPtr &Range=NullDomainRangeShPtr)
Definition: PtsIO.cpp:220
void SetUpFieldMetaData(const std::string outname)
Definition: PtsIO.cpp:311
void ImportFieldData(const std::string inFile, PtsFieldSharedPtr &ptsField, DomainRangeShPtr &Range=NullDomainRangeShPtr)
Definition: PtsIO.cpp:214
virtual std::string GetFileEnding() const
Helper function that determines default file extension.
Definition: PtsIO.h:95
void Import(const std::string &inFile, PtsFieldSharedPtr &ptsField, FieldMetaDataMap &fieldmetadatamap=NullFieldMetaDataMap, DomainRangeShPtr &Range=NullDomainRangeShPtr)
Import a pts field from file.
Definition: PtsIO.cpp:71
std::map< std::string, std::string > PtsMetaDataMap
Definition: PtsIO.h:59
std::map< std::string, std::string > FieldMetaDataMap
Definition: FieldIO.h:52
static FieldMetaDataMap NullFieldMetaDataMap
Definition: FieldIO.h:53
static PtsMetaDataMap NullPtsMetaDataMap
Definition: PtsIO.h:60
std::shared_ptr< PtsField > PtsFieldSharedPtr
Definition: PtsField.h:182
std::shared_ptr< DomainRange > DomainRangeShPtr
Definition: DomainRange.h:61
std::shared_ptr< PtsIO > PtsIOSharedPtr
Definition: PtsIO.h:101
static DomainRangeShPtr NullDomainRangeShPtr
Definition: DomainRange.h:62
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:54
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1