Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
b58393a9
There was an error fetching the commit references. Please try again later.
Commit
b58393a9
authored
7 years ago
by
Jakub Klinkovský
Browse files
Options
Downloads
Patches
Plain Diff
Fixed NetgenWriter
parent
389c0037
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/TNL/Meshes/Writers/NetgenWriter.h
+28
-42
28 additions, 42 deletions
src/TNL/Meshes/Writers/NetgenWriter.h
with
28 additions
and
42 deletions
src/TNL/Meshes/Writers/NetgenWriter.h
+
28
−
42
View file @
b58393a9
...
@@ -16,69 +16,55 @@
...
@@ -16,69 +16,55 @@
#pragma once
#pragma once
#include
<fstream>
#include
<ostream>
#include
<istream>
#include
<sstream>
#include
<iomanip>
#include
<iomanip>
#include
<TNL/String.h>
#include
<TNL/String.h>
namespace
TNL
{
namespace
TNL
{
namespace
Meshes
{
namespace
Meshes
{
namespace
Writers
{
class
MeshWriterNetgen
template
<
typename
Mesh
>
class
NetgenWriter
{
{
public:
using
GlobalIndexType
=
typename
Mesh
::
GlobalIndexType
;
using
PointType
=
typename
Mesh
::
PointType
;
using
Cell
=
typename
Mesh
::
Cell
;
static
constexpr
int
meshDimension
=
Mesh
::
getMeshDimension
();
template
<
typename
MeshType
>
public:
static
bool
writeMesh
(
const
String
&
fileName
,
static
void
writeMesh
(
const
Mesh
&
mesh
,
std
::
ostream
&
str
)
MeshType
&
mesh
,
bool
verbose
)
{
{
std
::
fstream
outputFile
;
str
<<
std
::
setprecision
(
6
);
outputFile
.
open
(
fileName
.
getString
(),
std
::
ios
::
out
);
str
<<
std
::
fixed
;
if
(
!
outputFile
)
{
std
::
cerr
<<
"I am not able to open the output file "
<<
fileName
<<
"."
<<
std
::
endl
;
return
false
;
}
outputFile
<<
std
::
setprecision
(
6
);
outputFile
<<
std
::
fixed
;
const
int
meshDimension
=
MeshType
::
meshDimension
;
const
GlobalIndexType
numberOfVertices
=
mesh
.
template
getEntitiesCount
<
typename
Mesh
::
Vertex
>();
typedef
typename
MeshType
::
template
EntitiesTraits
<
0
>
::
GlobalIndexType
VerticesIndexType
;
str
<<
numberOfVertices
<<
std
::
endl
;
typedef
typename
MeshType
::
PointType
PointType
;
for
(
GlobalIndexType
i
=
0
;
i
<
numberOfVertices
;
i
++
)
const
VerticesIndexType
numberOfVertices
=
mesh
.
getVerticesCount
();
outputFile
<<
numberOfVertices
<<
std
::
endl
;
for
(
VerticesIndexType
i
=
0
;
i
<
numberOfVertices
;
i
++
)
{
{
const
PointType
&
point
=
mesh
.
get
Vertex
(
i
).
getPoint
();
const
PointType
&
point
=
mesh
.
template
getEntity
<
typename
Mesh
::
Vertex
>
(
i
).
getPoint
();
outputFile
<<
" "
;
str
<<
" "
;
for
(
int
d
=
0
;
d
<
meshDimension
;
d
++
)
for
(
int
d
=
0
;
d
<
meshDimension
;
d
++
)
outputFile
<<
" "
<<
point
[
d
];
str
<<
" "
<<
point
[
d
];
outputFile
<<
std
::
endl
;
str
<<
std
::
endl
;
}
}
typedef
typename
MeshType
::
template
EntitiesTraits
<
meshDimension
>
::
GlobalIndexType
CellIndexType
;
const
GlobalIndexType
numberOfCells
=
mesh
.
template
getEntitiesCount
<
typename
Mesh
::
Cell
>();
typedef
typename
MeshType
::
template
EntitiesTraits
<
meshDimension
>
::
Type
CellType
;
str
<<
numberOfCells
<<
std
::
endl
;
typedef
typename
CellType
::
LocalIndexType
LocalIndexType
;
for
(
GlobalIndexType
cellIdx
=
0
;
cellIdx
<
numberOfCells
;
cellIdx
++
)
const
CellIndexType
numberOfCells
=
mesh
.
template
getEntitiesCount
<
meshDimension
>();
outputFile
<<
numberOfCells
<<
std
::
endl
;
for
(
CellIndexType
cellIdx
=
0
;
cellIdx
<
numberOfCells
;
cellIdx
++
)
{
{
const
Cell
Type
&
cell
=
mesh
.
template
getEntity
<
meshDimension
>(
cellIdx
);
const
Cell
&
cell
=
mesh
.
template
getEntity
<
typename
Mesh
::
Cell
>(
cellIdx
);
outputFile
<<
" 1"
;
str
<<
" 1"
;
for
(
LocalIndexType
cellVertexIdx
=
0
;
for
(
int
cellVertexIdx
=
0
;
cellVertexIdx
<
meshDimension
+
1
;
cellVertexIdx
<
meshDimension
+
1
;
cellVertexIdx
++
)
cellVertexIdx
++
)
outputFile
<<
" "
<<
cell
.
getVertexIndex
(
cellVertexIdx
);
str
<<
" "
<<
cell
.
getVertexIndex
(
cellVertexIdx
);
outputFile
<<
std
::
endl
;
str
<<
"
\n
"
;
}
}
return
true
;
}
}
};
};
}
// namespace Writers
}
// namespace Meshes
}
// namespace Meshes
}
// namespace TNL
}
// namespace TNL
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