Mesh Oriented datABase
(version 5.5.1)
An array-based unstructured mesh library
ReadSmf.hpp
Go to the documentation of this file.
1
/**
2
* MOAB, a Mesh-Oriented datABase, is a software component for creating,
3
* storing and accessing finite element mesh data.
4
*
5
* Copyright 2004 Sandia Corporation. Under the terms of Contract
6
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
7
* retains certain rights in this software.
8
*
9
* This library is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU Lesser General Public
11
* License as published by the Free Software Foundation; either
12
* version 2.1 of the License, or (at your option) any later version.
13
*
14
*/
15
16
#ifndef READ_SMF_HPP
17
#define READ_SMF_HPP
18
19
#define SMF_MAXLINE 4096
20
21
#include "
moab/Forward.hpp
"
22
#include "
moab/ReaderIface.hpp
"
23
24
#include "
SMF_State.hpp
"
25
#include <iosfwd>
26
#include <fstream>
27
28
namespace
moab
29
{
30
31
class
ReadUtilIface;
32
class
AffineXform
;
33
34
/**\brief Read SMF (Simple Model Format) files.
35
*
36
* File format is documented at:
37
* http://people.sc.fsu.edu/~burkardt/data/smf/smf.txt
38
*/
39
class
ReadSmf
:
public
ReaderIface
40
{
41
42
public
:
43
static
ReaderIface
*
factory
(
Interface
* );
44
45
//! load a file
46
ErrorCode
load_file
(
const
char
* file_name,
47
const
EntityHandle
* file_set,
48
const
FileOptions
& opts,
49
const
SubsetList
* subset_list = 0,
50
const
Tag
* file_id_tag = 0 );
51
52
ErrorCode
read_tag_values
(
const
char
* file_name,
53
const
char
* tag_name,
54
const
FileOptions
& opts,
55
std::vector< int >& tag_values_out,
56
const
SubsetList
* subset_list = 0 );
57
58
//! Constructor
59
ReadSmf
(
Interface
* impl = NULL );
60
61
//! Destructor
62
virtual
~ReadSmf
();
63
64
typedef
ErrorCode
(
ReadSmf
::*
read_cmd
)( std::vector< std::string >& argv );
65
struct
cmd_entry
66
{
67
const
char
*
name
;
68
read_cmd
cmd
;
69
};
70
void
init
();
71
72
protected
:
73
ErrorCode
annotation
(
char
* cmd, std::vector< std::string >& argv );
74
void
bad_annotation
(
const
char
* cmd );
75
76
ErrorCode
vertex
( std::vector< std::string >& );
77
ErrorCode
v_normal
( std::vector< std::string >& );
78
ErrorCode
v_color
( std::vector< std::string >& );
79
ErrorCode
f_color
( std::vector< std::string >& );
80
ErrorCode
face
( std::vector< std::string >& );
81
82
ErrorCode
begin
( std::vector< std::string >& );
83
ErrorCode
end
( std::vector< std::string >& );
84
ErrorCode
set
( std::vector< std::string >& );
85
ErrorCode
inc
( std::vector< std::string >& );
86
ErrorCode
dec
( std::vector< std::string >& );
87
88
ErrorCode
trans
( std::vector< std::string >& );
89
ErrorCode
scale
( std::vector< std::string >& );
90
ErrorCode
rot
( std::vector< std::string >& );
91
ErrorCode
mmult
( std::vector< std::string >& );
92
ErrorCode
mload
( std::vector< std::string >& );
93
94
ErrorCode
parse_line
(
char
*
line
);
95
96
ErrorCode
parse_doubles
(
int
count,
const
std::vector< std::string >& argv,
double
results[] );
97
ErrorCode
parse_mat
(
const
std::vector< std::string >& argv,
AffineXform
& mat_out );
98
ErrorCode
check_length
(
int
count,
const
std::vector< std::string >& argv );
99
100
private
:
101
ReadUtilIface
*
readMeshIface
;
102
103
//------------member variables ------------//
104
105
//! interface instance
106
//! interface instance
107
Interface
*
mdbImpl
;
108
109
//! Meshset Handle for the mesh that is currently being read
110
EntityHandle
mCurrentMeshHandle
;
111
112
//! A field which, if present and having a single integer for storage, should be used to
113
//! partition the mesh by range. Defaults to MATERIAL_SET_TAG_NAME
114
std::string
mPartitionTagName
;
115
116
// these are from SMF_reader from qslim/gfx/SMF/smf.h
117
static
cmd_entry
read_cmds
[];
118
char
line
[
SMF_MAXLINE
];
119
std::vector< SMF_State >
state
;
120
SMF_ivars
ivar
;
121
int
_numNodes
;
122
int
_numFaces
;
123
std::vector< double >
_coords
;
// 3*numNodes; we might not know the number of nodes
124
std::vector< int >
_connec
;
// 3*num of elements; we might not know them;
125
int
_numNodesInFile
;
126
int
_numElementsInFile
;
127
size_t
lineNo
;
128
size_t
commandNo
;
129
int
versionMajor
,
versionMinor
;
130
};
131
132
}
// namespace moab
133
134
#endif
src
io
ReadSmf.hpp
Generated on Tue Oct 29 2024 02:05:48 for Mesh Oriented datABase by
1.9.1.