Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenVolumeMesh
OpenVolumeMesh
Commits
4ebfee6c
Commit
4ebfee6c
authored
Nov 09, 2015
by
Max Lyon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added test for tetrahedral mesh in file manager
parent
944dbb4a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
0 deletions
+51
-0
src/OpenVolumeMesh/FileManager/FileManager.cc
src/OpenVolumeMesh/FileManager/FileManager.cc
+44
-0
src/OpenVolumeMesh/FileManager/FileManager.hh
src/OpenVolumeMesh/FileManager/FileManager.hh
+7
-0
No files found.
src/OpenVolumeMesh/FileManager/FileManager.cc
View file @
4ebfee6c
...
...
@@ -181,6 +181,50 @@ bool FileManager::isHexahedralMesh(const std::string& _filename) const {
return
true
;
}
bool
FileManager
::
isTetrahedralMesh
(
const
std
::
string
&
_filename
)
const
{
std
::
ifstream
iff
(
_filename
.
c_str
(),
std
::
ios
::
in
);
if
(
!
iff
.
good
())
{
std
::
cerr
<<
"Could not open file "
<<
_filename
<<
" for reading!"
<<
std
::
endl
;
iff
.
close
();
return
false
;
}
std
::
string
s
;
unsigned
int
n
=
0u
;
// Skip until we find polyhedra section
while
(
true
||
!
iff
.
eof
())
{
iff
>>
s
;
if
(
s
==
"Polyhedra"
)
{
break
;
}
}
if
(
iff
.
eof
())
{
// Polyhedra section not found in file. Defaulting to polyhedral type.
iff
.
close
();
return
false
;
}
// Read in number of cells
iff
>>
n
;
if
(
n
==
0
)
return
false
;
unsigned
int
v
=
0
;
char
tmp
[
256
];
for
(
unsigned
int
i
=
0
;
i
<
n
;
++
i
)
{
iff
>>
v
;
iff
.
getline
(
tmp
,
256
);
if
(
v
!=
4u
)
{
iff
.
close
();
return
false
;
}
}
iff
.
close
();
return
true
;
}
//==================================================
}
// Namespace IO
...
...
src/OpenVolumeMesh/FileManager/FileManager.hh
View file @
4ebfee6c
...
...
@@ -105,6 +105,13 @@ public:
*/
bool
isHexahedralMesh
(
const
std
::
string
&
_filename
)
const
;
/**
* \brief Test whether given file contains a tetrahedral mesh
*/
bool
isTetrahedralMesh
(
const
std
::
string
&
_filename
)
const
;
private:
// Read property
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment