Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
aeec1b2f
Commit
aeec1b2f
authored
May 3, 2018
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
prepares reading of physical attributes in gmsh format 2.2
parent
2c73c7eb
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mesh/GmshReader.cpp
+66
-51
66 additions, 51 deletions
src/mesh/GmshReader.cpp
src/mesh/GmshReader.hpp
+7
-10
7 additions, 10 deletions
src/mesh/GmshReader.hpp
with
73 additions
and
61 deletions
src/mesh/GmshReader.cpp
+
66
−
51
View file @
aeec1b2f
...
...
@@ -145,6 +145,8 @@ GmshReader::GmshReader(const std::string& filename)
__keywordList
[
"$EndNodes"
]
=
ENDNODES
;
__keywordList
[
"$Elements"
]
=
ELEMENTS
;
__keywordList
[
"$EndElements"
]
=
ENDELEMENTS
;
__keywordList
[
"$PhysicalNames"
]
=
PHYSICALNAMES
;
__keywordList
[
"$EndPhysicalNames"
]
=
ENDPHYSICALNAMES
;
__numberOfPrimitiveNodes
.
resize
(
16
);
__numberOfPrimitiveNodes
[
0
]
=
2
;
// edge
...
...
@@ -489,6 +491,14 @@ GmshReader::__readElements2_2()
}
}
void
GmshReader
::
__readPhysicalNames2_2
()
{
std
::
cerr
<<
__FILE__
<<
':'
<<
__LINE__
<<
": NIY
\n
"
;
std
::
exit
(
0
);
}
void
GmshReader
::
__proceedData
()
{
...
...
@@ -869,16 +879,11 @@ GmshReader::__nextKeyword()
{
GmshReader
::
Keyword
kw
;
std
::
cerr
<<
"warning: "
<<
rang
::
fg
::
red
<<
__PRETTY_FUNCTION__
<<
rang
::
fg
::
reset
<<
" keyword validity not checked!
\n
"
;
int
retval
=
1
;
std
::
string
aKeyword
;
m_fin
>>
aKeyword
;
if
(
retval
<
0
)
{
if
(
not
m_fin
)
{
kw
.
second
=
EndOfFile
;
return
kw
;
}
else
if
(
retval
==
0
)
{
kw
.
second
=
Unknown
;
return
kw
;
}
KeywordList
::
iterator
i
=
__keywordList
.
find
(
aKeyword
.
c_str
());
...
...
@@ -889,10 +894,10 @@ GmshReader::__nextKeyword()
return
kw
;
}
//
throw ErrorHandler(__FILE__,__LINE__,
//
"reading file '"+m_filename
//
+"': unknown keyword '"+aKeyword+"'",
//
ErrorHandler::normal);
throw
ErrorHandler
(
__FILE__
,
__LINE__
,
"reading file '"
+
m_filename
+
"': unknown keyword '"
+
aKeyword
+
"'"
,
ErrorHandler
::
normal
);
kw
.
first
=
aKeyword
;
kw
.
second
=
Unknown
;
...
...
@@ -903,41 +908,51 @@ void GmshReader::
__readGmshFormat2_2
()
{
std
::
cout
<<
"- Reading Gmsh format 2.2
\n
"
;
GmshReader
::
Keyword
kw
;
GmshReader
::
Keyword
kw
=
std
::
make_pair
(
""
,
Unknown
);
while
(
kw
.
second
!=
EndOfFile
)
{
kw
=
this
->
__nextKeyword
();
if
(
kw
.
second
!=
NODES
)
{
// throw ErrorHandler(__FILE__,__LINE__,
// "reading file '"+m_filename
// +"': expecting $Nodes, '"+kw.first+"' was found",
// ErrorHandler::normal);
}
switch
(
kw
.
second
)
{
case
NODES
:
{
this
->
__readVertices
();
kw
=
this
->
__nextKeyword
();
if
(
kw
.
second
!=
ENDNODES
)
{
// throw ErrorHandler(__FILE__,__LINE__,
// "reading file '"+m_filename
// +"': expecting $EndNodes, '"+kw.first+"' was found",
// ErrorHandler::normal);
if
(
this
->
__nextKeyword
().
second
!=
ENDNODES
)
{
throw
ErrorHandler
(
__FILE__
,
__LINE__
,
"reading file '"
+
m_filename
+
"': expecting $EndNodes, '"
+
kw
.
first
+
"' was found"
,
ErrorHandler
::
normal
);
}
// Getting elements list
kw
=
this
->
__nextKeyword
();
if
(
kw
.
second
!=
ELEMENTS
)
{
// throw ErrorHandler(__FILE__,__LINE__,
// "reading file '"+m_filename
// +"': expecting $Elements, '"+kw.first+"' was found",
// ErrorHandler::normal);
break
;
}
case
ELEMENTS
:
{
this
->
__readElements2_2
();
kw
=
this
->
__nextKeyword
();
if
(
kw
.
second
!=
ENDELEMENTS
)
{
// throw ErrorHandler(__FILE__,__LINE__,
// "reading file '"+m_filename
// +"': expecting $EndElements, '"+kw.first+"' was found",
// ErrorHandler::normal);
throw
ErrorHandler
(
__FILE__
,
__LINE__
,
"reading file '"
+
m_filename
+
"': expecting $EndElements, '"
+
kw
.
first
+
"' was found"
,
ErrorHandler
::
normal
);
}
break
;
}
case
PHYSICALNAMES
:
{
this
->
__readPhysicalNames2_2
();
if
(
this
->
__nextKeyword
().
second
!=
ENDPHYSICALNAMES
)
{
throw
ErrorHandler
(
__FILE__
,
__LINE__
,
"reading file '"
+
m_filename
+
"': expecting $EndNodes, '"
+
kw
.
first
+
"' was found"
,
ErrorHandler
::
normal
);
}
break
;
}
case
EndOfFile
:
{
break
;
}
default
:
{
throw
ErrorHandler
(
__FILE__
,
__LINE__
,
"reading file '"
+
m_filename
+
"': unexpected '"
+
kw
.
first
+
"'"
,
ErrorHandler
::
normal
);
}
}
}
}
This diff is collapsed.
Click to expand it.
src/mesh/GmshReader.hpp
+
7
−
10
View file @
aeec1b2f
...
...
@@ -126,6 +126,8 @@ private:
ENDNODES
,
ELEMENTS
,
ENDELEMENTS
,
PHYSICALNAMES
,
ENDPHYSICALNAMES
,
Unknown
,
EndOfFile
...
...
@@ -176,16 +178,11 @@ private:
*/
void
__readElements2_2
();
// /**
// * Common interface for writing references
// *
// * @param references the set of computed references
// * @param objectName the type of refernces
// */
// void __writeReferences(const std::set<size_t>& references,
// std::string objectName);
/**
* Reads physical names
*
*/
void
__readPhysicalNames2_2
();
Connectivity2D
*
m_connectivity
;
Mesh
<
Connectivity2D
>*
m_mesh
;
...
...
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