Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitri Naumov
ogs
Commits
8bf1634b
Commit
8bf1634b
authored
5 years ago
by
Karsten Rink
Committed by
Tom Fischer
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
renaming enum classes
parent
63d7fd87
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Applications/FileIO/GocadIO/GocadAsciiReader.cpp
+20
-21
20 additions, 21 deletions
Applications/FileIO/GocadIO/GocadAsciiReader.cpp
Applications/FileIO/GocadIO/GocadAsciiReader.h
+7
-6
7 additions, 6 deletions
Applications/FileIO/GocadIO/GocadAsciiReader.h
with
27 additions
and
27 deletions
Applications/FileIO/GocadIO/GocadAsciiReader.cpp
+
20
−
21
View file @
8bf1634b
...
@@ -33,10 +33,9 @@ const std::string mat_id_name = "MaterialIDs";
...
@@ -33,10 +33,9 @@ const std::string mat_id_name = "MaterialIDs";
const
std
::
string
eof_error
=
"Error: Unexpected end of file."
;
const
std
::
string
eof_error
=
"Error: Unexpected end of file."
;
GocadAsciiReader
::
GocadAsciiReader
()
GocadAsciiReader
::
GocadAsciiReader
()
:
_export_type
(
GOCAD_DATA_TYPE
::
ALL
)
:
_export_type
(
GocadDataType
::
ALL
)
{}
{}
GocadAsciiReader
::
GocadAsciiReader
(
G
OCAD_DATA_TYPE
const
t
)
GocadAsciiReader
::
GocadAsciiReader
(
G
ocadDataType
const
t
)
:
_export_type
(
t
)
:
_export_type
(
t
)
{}
{}
...
@@ -75,20 +74,20 @@ bool GocadAsciiReader::readFile(
...
@@ -75,20 +74,20 @@ bool GocadAsciiReader::readFile(
return
false
;
return
false
;
}
}
G
OCAD_DATA_TYPE
type
;
G
ocadDataType
type
;
while
((
type
=
datasetFound
(
in
))
!=
G
OCAD_DATA_TYPE
::
UNDEFINED
)
while
((
type
=
datasetFound
(
in
))
!=
G
ocadDataType
::
UNDEFINED
)
{
{
if
(
_export_type
!=
G
OCAD_DATA_TYPE
::
ALL
&&
type
!=
_export_type
)
if
(
_export_type
!=
G
ocadDataType
::
ALL
&&
type
!=
_export_type
)
{
{
skipToEND
(
in
);
skipToEND
(
in
);
continue
;
continue
;
}
}
if
(
type
==
G
OCAD_DATA_TYPE
::
VSET
||
type
==
G
OCAD_DATA_TYPE
::
MODEL3D
)
if
(
type
==
G
ocadDataType
::
VSET
||
type
==
G
ocadDataType
::
MODEL3D
)
{
{
if
(
!
skipToEND
(
in
))
if
(
!
skipToEND
(
in
))
{
{
std
::
string
const
t
=
(
type
==
G
OCAD_DATA_TYPE
::
VSET
)
?
"VSet"
:
"Model3D"
;
std
::
string
const
t
=
(
type
==
G
ocadDataType
::
VSET
)
?
"VSet"
:
"Model3D"
;
ERR
(
"Parsing of type %s is not implemented. Skipping section."
,
t
);
ERR
(
"Parsing of type %s is not implemented. Skipping section."
,
t
);
return
false
;
return
false
;
}
}
...
@@ -110,7 +109,7 @@ bool GocadAsciiReader::readFile(
...
@@ -110,7 +109,7 @@ bool GocadAsciiReader::readFile(
}
}
MeshLib
::
Mesh
*
GocadAsciiReader
::
readData
(
std
::
ifstream
&
in
,
MeshLib
::
Mesh
*
GocadAsciiReader
::
readData
(
std
::
ifstream
&
in
,
G
OCAD_DATA_TYPE
const
&
type
,
G
ocadDataType
const
&
type
,
std
::
string
&
mesh_name
)
std
::
string
&
mesh_name
)
{
{
if
(
!
parseHeader
(
in
,
mesh_name
))
if
(
!
parseHeader
(
in
,
mesh_name
))
...
@@ -160,7 +159,7 @@ MeshLib::Mesh* GocadAsciiReader::readData(std::ifstream& in,
...
@@ -160,7 +159,7 @@ MeshLib::Mesh* GocadAsciiReader::readData(std::ifstream& in,
return
nullptr
;
return
nullptr
;
}
}
}
}
else
if
(
type
==
G
OCAD_DATA_TYPE
::
PLINE
&&
str
[
0
]
==
"ILINE"
)
else
if
(
type
==
G
ocadDataType
::
PLINE
&&
str
[
0
]
==
"ILINE"
)
{
{
std
::
vector
<
MeshLib
::
Node
*>
nodes
;
std
::
vector
<
MeshLib
::
Node
*>
nodes
;
std
::
vector
<
MeshLib
::
Element
*>
elems
;
std
::
vector
<
MeshLib
::
Element
*>
elems
;
...
@@ -174,7 +173,7 @@ MeshLib::Mesh* GocadAsciiReader::readData(std::ifstream& in,
...
@@ -174,7 +173,7 @@ MeshLib::Mesh* GocadAsciiReader::readData(std::ifstream& in,
}
}
return
new
MeshLib
::
Mesh
(
mesh_name
,
nodes
,
elems
,
mesh_prop
);
return
new
MeshLib
::
Mesh
(
mesh_name
,
nodes
,
elems
,
mesh_prop
);
}
}
else
if
(
type
==
G
OCAD_DATA_TYPE
::
TSURF
&&
str
[
0
]
==
"TFACE"
)
else
if
(
type
==
G
ocadDataType
::
TSURF
&&
str
[
0
]
==
"TFACE"
)
{
{
std
::
vector
<
MeshLib
::
Node
*>
nodes
;
std
::
vector
<
MeshLib
::
Node
*>
nodes
;
std
::
vector
<
MeshLib
::
Element
*>
elems
;
std
::
vector
<
MeshLib
::
Element
*>
elems
;
...
@@ -198,7 +197,7 @@ MeshLib::Mesh* GocadAsciiReader::readData(std::ifstream& in,
...
@@ -198,7 +197,7 @@ MeshLib::Mesh* GocadAsciiReader::readData(std::ifstream& in,
return
nullptr
;
return
nullptr
;
}
}
G
OCAD_DATA_TYPE
GocadAsciiReader
::
datasetFound
(
std
::
ifstream
&
in
)
const
G
ocadDataType
GocadAsciiReader
::
datasetFound
(
std
::
ifstream
&
in
)
const
{
{
std
::
string
line
;
std
::
string
line
;
while
(
std
::
getline
(
in
,
line
))
while
(
std
::
getline
(
in
,
line
))
...
@@ -210,27 +209,27 @@ GOCAD_DATA_TYPE GocadAsciiReader::datasetFound(std::ifstream& in) const
...
@@ -210,27 +209,27 @@ GOCAD_DATA_TYPE GocadAsciiReader::datasetFound(std::ifstream& in) const
if
(
line
.
substr
(
0
,
10
)
==
"GOCAD VSet"
)
if
(
line
.
substr
(
0
,
10
)
==
"GOCAD VSet"
)
{
{
return
G
OCAD_DATA_TYPE
::
VSET
;
return
G
ocadDataType
::
VSET
;
}
}
else
if
(
line
.
substr
(
0
,
11
)
==
"GOCAD PLine"
)
else
if
(
line
.
substr
(
0
,
11
)
==
"GOCAD PLine"
)
{
{
return
G
OCAD_DATA_TYPE
::
PLINE
;
return
G
ocadDataType
::
PLINE
;
}
}
else
if
(
line
.
substr
(
0
,
11
)
==
"GOCAD TSurf"
)
else
if
(
line
.
substr
(
0
,
11
)
==
"GOCAD TSurf"
)
{
{
return
G
OCAD_DATA_TYPE
::
TSURF
;
return
G
ocadDataType
::
TSURF
;
}
}
else
if
(
line
.
substr
(
0
,
13
)
==
"GOCAD Model3d"
)
else
if
(
line
.
substr
(
0
,
13
)
==
"GOCAD Model3d"
)
{
{
return
G
OCAD_DATA_TYPE
::
MODEL3D
;
return
G
ocadDataType
::
MODEL3D
;
}
}
else
else
{
{
ERR
(
"No known identifier found..."
);
ERR
(
"No known identifier found..."
);
return
G
OCAD_DATA_TYPE
::
UNDEFINED
;
return
G
ocadDataType
::
UNDEFINED
;
}
}
}
}
return
G
OCAD_DATA_TYPE
::
UNDEFINED
;
return
G
ocadDataType
::
UNDEFINED
;
}
}
bool
GocadAsciiReader
::
isCommentLine
(
std
::
string
const
&
str
)
const
bool
GocadAsciiReader
::
isCommentLine
(
std
::
string
const
&
str
)
const
...
@@ -439,7 +438,7 @@ bool GocadAsciiReader::parseNodes(
...
@@ -439,7 +438,7 @@ bool GocadAsciiReader::parseNodes(
std
::
map
<
std
::
size_t
,
std
::
size_t
>&
node_id_map
,
std
::
map
<
std
::
size_t
,
std
::
size_t
>&
node_id_map
,
MeshLib
::
Properties
&
mesh_prop
)
MeshLib
::
Properties
&
mesh_prop
)
{
{
N
ODE_TYPE
t
=
NODE_TYPE
::
UNSPECIFIED
;
N
odeType
t
=
NodeType
::
UNSPECIFIED
;
double
value
;
double
value
;
std
::
vector
<
std
::
string
>
const
array_names
=
std
::
vector
<
std
::
string
>
const
array_names
=
mesh_prop
.
getPropertyVectorNames
();
mesh_prop
.
getPropertyVectorNames
();
...
@@ -472,11 +471,11 @@ bool GocadAsciiReader::parseNodes(
...
@@ -472,11 +471,11 @@ bool GocadAsciiReader::parseNodes(
}
}
std
::
stringstream
sstr
(
line
);
std
::
stringstream
sstr
(
line
);
if
(
line
.
substr
(
0
,
4
)
==
"VRTX"
&&
t
!=
N
ODE_TYPE
::
PVRTX
)
if
(
line
.
substr
(
0
,
4
)
==
"VRTX"
&&
t
!=
N
odeType
::
PVRTX
)
{
{
nodes
.
push_back
(
createNode
(
sstr
));
nodes
.
push_back
(
createNode
(
sstr
));
}
}
else
if
(
line
.
substr
(
0
,
5
)
==
"PVRTX"
&&
t
!=
N
ODE_TYPE
::
VRTX
)
else
if
(
line
.
substr
(
0
,
5
)
==
"PVRTX"
&&
t
!=
N
odeType
::
VRTX
)
{
{
nodes
.
push_back
(
createNode
(
sstr
));
nodes
.
push_back
(
createNode
(
sstr
));
for
(
std
::
string
const
&
name
:
array_names
)
for
(
std
::
string
const
&
name
:
array_names
)
...
...
This diff is collapsed.
Click to expand it.
Applications/FileIO/GocadIO/GocadAsciiReader.h
+
7
−
6
View file @
8bf1634b
...
@@ -27,7 +27,7 @@ namespace FileIO
...
@@ -27,7 +27,7 @@ namespace FileIO
namespace
Gocad
namespace
Gocad
{
{
enum
class
G
OCAD_DATA_TYPE
enum
class
G
ocadDataType
{
{
UNDEFINED
,
UNDEFINED
,
VSET
,
VSET
,
...
@@ -43,7 +43,7 @@ public:
...
@@ -43,7 +43,7 @@ public:
explicit
GocadAsciiReader
();
explicit
GocadAsciiReader
();
/// Constructor taking a specific data type (will only export that type)
/// Constructor taking a specific data type (will only export that type)
explicit
GocadAsciiReader
(
G
OCAD_DATA_TYPE
const
t
);
explicit
GocadAsciiReader
(
G
ocadDataType
const
t
);
GocadAsciiReader
(
GocadAsciiReader
&&
src
)
=
delete
;
GocadAsciiReader
(
GocadAsciiReader
&&
src
)
=
delete
;
GocadAsciiReader
(
GocadAsciiReader
const
&
src
)
=
delete
;
GocadAsciiReader
(
GocadAsciiReader
const
&
src
)
=
delete
;
...
@@ -55,13 +55,14 @@ public:
...
@@ -55,13 +55,14 @@ public:
private:
private:
/// Reads one mesh contained in the file (there may be more than one!)
/// Reads one mesh contained in the file (there may be more than one!)
MeshLib
::
Mesh
*
readData
(
std
::
ifstream
&
in
,
GOCAD_DATA_TYPE
const
&
type
,
std
::
string
&
mesh_name
);
MeshLib
::
Mesh
*
readData
(
std
::
ifstream
&
in
,
GocadDataType
const
&
type
,
std
::
string
&
mesh_name
);
/// Checks if the current line is a comment
/// Checks if the current line is a comment
bool
isCommentLine
(
std
::
string
const
&
str
)
const
;
bool
isCommentLine
(
std
::
string
const
&
str
)
const
;
/// Checks if a GoCAD identifier is found at the current stream position.
/// Checks if a GoCAD identifier is found at the current stream position.
G
OCAD_DATA_TYPE
datasetFound
(
std
::
ifstream
&
in
)
const
;
G
ocadDataType
datasetFound
(
std
::
ifstream
&
in
)
const
;
/// Parses the HEADER section (everything except the name is ignored right now)
/// Parses the HEADER section (everything except the name is ignored right now)
bool
parseHeader
(
std
::
ifstream
&
in
,
std
::
string
&
mesh_name
);
bool
parseHeader
(
std
::
ifstream
&
in
,
std
::
string
&
mesh_name
);
...
@@ -112,14 +113,14 @@ private:
...
@@ -112,14 +113,14 @@ private:
void
clearData
(
std
::
vector
<
MeshLib
::
Node
*>&
nodes
,
void
clearData
(
std
::
vector
<
MeshLib
::
Node
*>&
nodes
,
std
::
vector
<
MeshLib
::
Element
*>&
elems
);
std
::
vector
<
MeshLib
::
Element
*>&
elems
);
enum
class
N
ODE_TYPE
enum
class
N
odeType
{
{
UNSPECIFIED
,
UNSPECIFIED
,
VRTX
,
VRTX
,
PVRTX
PVRTX
};
};
G
OCAD_DATA_TYPE
_export_type
;
G
ocadDataType
_export_type
;
};
// end class GocadAsciiReader
};
// end class GocadAsciiReader
}
// end namespace Gocad
}
// end namespace Gocad
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment