FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
io_common.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
8#include <kernel/util/string.hpp>
9
10namespace FEAT::Geometry
11{
13 enum class ParsedMeshType
14 {
16 unknown = 0,
19 };
20
21 inline std::ostream& operator<<(std::ostream& s, ParsedMeshType meshtype)
22 {
23 switch(meshtype)
24 {
25 case ParsedMeshType::unknown: s << "unknown"; break;
26 case ParsedMeshType::conformal: s << "conformal"; break;
27 }
28 return s;
29 }
30
31 inline std::istream& operator>>(std::istream& is, ParsedMeshType& meshtype)
32 {
33 String s;
34 if((is >> s).fail())
35 {
36 return is;
37 }
38
39 if(s.compare_no_case("unknown") == 0)
40 {
41 meshtype = ParsedMeshType::unknown;
42 }
43 else if(s.compare_no_case("conformal") == 0)
44 {
46 }
47 else
48 {
49 is.setstate(std::ios_base::failbit);
50 }
51
52 return is;
53 }
54
56 enum class ParsedShapeType
57 {
59 unknown = 0,
61 simplex,
64 };
65
66 inline std::ostream& operator<<(std::ostream& s, ParsedShapeType shapetype)
67 {
68 switch(shapetype)
69 {
70 case ParsedShapeType::unknown: s << "unknown"; break;
71 case ParsedShapeType::simplex: s << "simplex"; break;
72 case ParsedShapeType::hypercube: s << "hypercube"; break;
73 }
74 return s;
75 }
76
77 inline std::istream& operator>>(std::istream& is, ParsedShapeType& shapetype)
78 {
79 String s;
80 if((is >> s).fail())
81 {
82 return is;
83 }
84
85 if(s.compare_no_case("unknown") == 0)
86 {
87 shapetype = ParsedShapeType::unknown;
88 }
89 else if(s.compare_no_case("simplex") == 0)
90 {
91 shapetype = ParsedShapeType::simplex;
92 }
93 else if(s.compare_no_case("hypercube") == 0)
94 {
96 }
97 else
98 {
99 is.setstate(std::ios_base::failbit);
100 }
101
102 return is;
103 }
104} // namespace FEAT::Geometry
Geometry namespace.
ParsedMeshType
mesh type enumeration
Definition: io_common.hpp:14
@ unknown
unknown mesh type
@ conformal
conformal mesh type
ParsedShapeType
shape type enumeration
Definition: io_common.hpp:57
@ simplex
simplex shape type
@ hypercube
hypercube shape type
@ unknown
unknown shape type