IOSS 2.0

CatalystParserInterface.h
Go to the documentation of this file.
1 /*
2 * Copyright(C) 1999-2017 National Technology & Engineering Solutions
3 * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
4 * NTESS, the U.S. Government retains certain rights in this software.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 *
18 * * Neither the name of NTESS nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 #ifndef __CatalystParserInterface_h
36 #define __CatalystParserInterface_h
37
38 #include <map>
39 #include <string>
40 #include <utility>
41 #include <vector>
42
43 class CatalystParserInterface
44 {
45 public:
46 enum var_type {
47 SCALAR,
48 VECTOR,
49 TENSOR,
50 ALLTYPE,
51 SCALAR_USED,
52 VECTOR_USED,
53 TENSOR_USED,
54 ALLTYPE_USED
55 };
56
57 typedef std::map<std::string, var_type> var_map;
58 typedef std::pair<unsigned int, unsigned int> id_range;
59
60 class parse_info
61 {
62 public:
63 parse_info()
64 {
65 this->node_vars = 0;
66 this->element_vars = 0;
67 this->global_vars = 0;
68 this->nodeIDs = 0;
69 this->elementIDs = 0;
70 this->separator = "_";
71 };
72
73 std::string json_result;
74 var_map * node_vars;
75 var_map * element_vars;
76 var_map * global_vars;
77 id_range * nodeIDs;
78 id_range * elementIDs;
79 std::string separator;
80 };
81
82 static int parseFile(const std::string &filepath, parse_info &pinfo);
83
84 static int parseString(const std::string &s, parse_info &pinfo);
85 };
86
87 #endif
CatalystParserInterface::SCALAR
Definition: CatalystParserInterface.h:47
CatalystParserInterface::TENSOR_USED
Definition: CatalystParserInterface.h:53
CatalystParserInterface::ALLTYPE_USED
Definition: CatalystParserInterface.h:54
CatalystParserInterface::parse_info::json_result
std::string json_result
Definition: CatalystParserInterface.h:71
CatalystParserInterface::parse_info::nodeIDs
id_range * nodeIDs
Definition: CatalystParserInterface.h:77
CatalystParserInterface::parse_info::global_vars
var_map * global_vars
Definition: CatalystParserInterface.h:76
CatalystParserInterface
Definition: CatalystParserInterface.h:43
CatalystParserInterface::VECTOR_USED
Definition: CatalystParserInterface.h:52
CatalystParserInterface::id_range
std::pair< unsigned int, unsigned int > id_range
Definition: CatalystParserInterface.h:58
CatalystParserInterface::var_type
var_type
Definition: CatalystParserInterface.h:46
CatalystParserInterface::ALLTYPE
Definition: CatalystParserInterface.h:50
CatalystParserInterface::parseString
static int parseString(const std::string &s, parse_info &pinfo)
CatalystParserInterface::parse_info::element_vars
var_map * element_vars
Definition: CatalystParserInterface.h:75
CatalystParserInterface::parse_info::node_vars
var_map * node_vars
Definition: CatalystParserInterface.h:74
CatalystParserInterface::VECTOR
Definition: CatalystParserInterface.h:48
CatalystParserInterface::SCALAR_USED
Definition: CatalystParserInterface.h:51
CatalystParserInterface::parse_info::separator
std::string separator
Definition: CatalystParserInterface.h:79
CatalystParserInterface::parse_info::parse_info
parse_info()
Definition: CatalystParserInterface.h:63
CatalystParserInterface::parse_info
Definition: CatalystParserInterface.h:60
CatalystParserInterface::parse_info::elementIDs
id_range * elementIDs
Definition: CatalystParserInterface.h:78
CatalystParserInterface::parseFile
static int parseFile(const std::string &filepath, parse_info &pinfo)
CatalystParserInterface::var_map
std::map< std::string, var_type > var_map
Definition: CatalystParserInterface.h:57
CatalystParserInterface::TENSOR
Definition: CatalystParserInterface.h:49