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
85212904
There was an error fetching the commit references. Please try again later.
Commit
85212904
authored
8 years ago
by
Jakub Klinkovský
Browse files
Options
Downloads
Patches
Plain Diff
Implemented MeshFunctionGnuplotWriter for 3D grids
parent
0865f702
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
src/TNL/Functions/MeshFunctionGnuplotWriter.h
+57
-2
57 additions, 2 deletions
src/TNL/Functions/MeshFunctionGnuplotWriter.h
src/TNL/Functions/MeshFunctionGnuplotWriter_impl.h
+154
-3
154 additions, 3 deletions
src/TNL/Functions/MeshFunctionGnuplotWriter_impl.h
with
211 additions
and
5 deletions
src/TNL/Functions/MeshFunctionGnuplotWriter.h
+
57
−
2
View file @
85212904
...
...
@@ -13,7 +13,7 @@
#include
<TNL/Meshes/Grid.h>
namespace
TNL
{
namespace
Functions
{
namespace
Functions
{
template
<
typename
,
int
,
typename
>
class
MeshFunction
;
...
...
@@ -62,6 +62,7 @@ class MeshFunctionGnuplotWriter< MeshFunction< Meshes::Grid< 1, MeshReal, Device
std
::
ostream
&
str
);
};
/***
* 2D grids cells
*/
...
...
@@ -98,7 +99,6 @@ class MeshFunctionGnuplotWriter< MeshFunction< Meshes::Grid< 2, MeshReal, Device
std
::
ostream
&
str
);
};
/***
* 2D grids vertices
*/
...
...
@@ -117,6 +117,61 @@ class MeshFunctionGnuplotWriter< MeshFunction< Meshes::Grid< 2, MeshReal, Device
std
::
ostream
&
str
);
};
/***
* 3D grids cells
*/
template
<
typename
MeshReal
,
typename
Device
,
typename
MeshIndex
,
typename
Real
>
class
MeshFunctionGnuplotWriter
<
MeshFunction
<
Meshes
::
Grid
<
3
,
MeshReal
,
Device
,
MeshIndex
>
,
3
,
Real
>
>
{
public:
typedef
Meshes
::
Grid
<
3
,
MeshReal
,
Device
,
MeshIndex
>
MeshType
;
typedef
Real
RealType
;
typedef
Functions
::
MeshFunction
<
MeshType
,
3
,
RealType
>
MeshFunctionType
;
static
bool
write
(
const
MeshFunctionType
&
function
,
std
::
ostream
&
str
);
};
/***
* 3D grids faces
*/
template
<
typename
MeshReal
,
typename
Device
,
typename
MeshIndex
,
typename
Real
>
class
MeshFunctionGnuplotWriter
<
MeshFunction
<
Meshes
::
Grid
<
3
,
MeshReal
,
Device
,
MeshIndex
>
,
2
,
Real
>
>
{
public:
typedef
Meshes
::
Grid
<
3
,
MeshReal
,
Device
,
MeshIndex
>
MeshType
;
typedef
Real
RealType
;
typedef
Functions
::
MeshFunction
<
MeshType
,
2
,
RealType
>
MeshFunctionType
;
static
bool
write
(
const
MeshFunctionType
&
function
,
std
::
ostream
&
str
);
};
/***
* 3D grids vertices
*/
template
<
typename
MeshReal
,
typename
Device
,
typename
MeshIndex
,
typename
Real
>
class
MeshFunctionGnuplotWriter
<
MeshFunction
<
Meshes
::
Grid
<
3
,
MeshReal
,
Device
,
MeshIndex
>
,
0
,
Real
>
>
{
public:
typedef
Meshes
::
Grid
<
3
,
MeshReal
,
Device
,
MeshIndex
>
MeshType
;
typedef
Real
RealType
;
typedef
Functions
::
MeshFunction
<
MeshType
,
0
,
RealType
>
MeshFunctionType
;
static
bool
write
(
const
MeshFunctionType
&
function
,
std
::
ostream
&
str
);
};
}
// namespace Functions
}
// namespace TNL
This diff is collapsed.
Click to expand it.
src/TNL/Functions/MeshFunctionGnuplotWriter_impl.h
+
154
−
3
View file @
85212904
...
...
@@ -11,7 +11,7 @@
#pragma once
namespace
TNL
{
namespace
Functions
{
namespace
Functions
{
template
<
typename
MeshFunction
>
bool
...
...
@@ -124,7 +124,7 @@ write( const MeshFunctionType& function,
typedef
typename
MeshType
::
Face
EntityType
;
typedef
typename
EntityType
::
EntityOrientationType
EntityOrientation
;
EntityType
entity
(
mesh
);
entity
.
setOrientation
(
EntityOrientation
(
1.0
,
0.0
)
);
for
(
entity
.
getCoordinates
().
y
()
=
0
;
entity
.
getCoordinates
().
y
()
<
mesh
.
getDimensions
().
y
();
...
...
@@ -141,7 +141,7 @@ write( const MeshFunctionType& function,
}
str
<<
std
::
endl
;
}
entity
.
setOrientation
(
EntityOrientation
(
0.0
,
1.0
)
);
for
(
entity
.
getCoordinates
().
x
()
=
0
;
entity
.
getCoordinates
().
x
()
<
mesh
.
getDimensions
().
x
();
...
...
@@ -196,6 +196,157 @@ write( const MeshFunctionType& function,
return
true
;
}
/****
* 3D grid, cells
*/
template
<
typename
MeshReal
,
typename
Device
,
typename
MeshIndex
,
typename
Real
>
bool
MeshFunctionGnuplotWriter
<
MeshFunction
<
Meshes
::
Grid
<
3
,
MeshReal
,
Device
,
MeshIndex
>
,
3
,
Real
>
>::
write
(
const
MeshFunctionType
&
function
,
std
::
ostream
&
str
)
{
const
MeshType
&
mesh
=
function
.
getMesh
();
typename
MeshType
::
Cell
entity
(
mesh
);
for
(
entity
.
getCoordinates
().
z
()
=
0
;
entity
.
getCoordinates
().
z
()
<
mesh
.
getDimensions
().
z
();
entity
.
getCoordinates
().
z
()
++
)
for
(
entity
.
getCoordinates
().
y
()
=
0
;
entity
.
getCoordinates
().
y
()
<
mesh
.
getDimensions
().
y
();
entity
.
getCoordinates
().
y
()
++
)
{
for
(
entity
.
getCoordinates
().
x
()
=
0
;
entity
.
getCoordinates
().
x
()
<
mesh
.
getDimensions
().
x
();
entity
.
getCoordinates
().
x
()
++
)
{
entity
.
refresh
();
typename
MeshType
::
VertexType
v
=
entity
.
getCenter
();
str
<<
v
.
x
()
<<
" "
<<
v
.
y
()
<<
" "
<<
v
.
z
()
<<
" "
<<
function
.
getData
().
getElement
(
entity
.
getIndex
()
)
<<
std
::
endl
;
}
str
<<
std
::
endl
;
}
return
true
;
}
/****
* 3D grid, faces
*/
template
<
typename
MeshReal
,
typename
Device
,
typename
MeshIndex
,
typename
Real
>
bool
MeshFunctionGnuplotWriter
<
MeshFunction
<
Meshes
::
Grid
<
3
,
MeshReal
,
Device
,
MeshIndex
>
,
2
,
Real
>
>::
write
(
const
MeshFunctionType
&
function
,
std
::
ostream
&
str
)
{
const
MeshType
&
mesh
=
function
.
getMesh
();
typedef
typename
MeshType
::
Face
EntityType
;
typedef
typename
EntityType
::
EntityOrientationType
EntityOrientation
;
EntityType
entity
(
mesh
);
entity
.
setOrientation
(
EntityOrientation
(
1.0
,
0.0
,
0.0
)
);
for
(
entity
.
getCoordinates
().
z
()
=
0
;
entity
.
getCoordinates
().
z
()
<
mesh
.
getDimensions
().
z
();
entity
.
getCoordinates
().
z
()
++
)
for
(
entity
.
getCoordinates
().
y
()
=
0
;
entity
.
getCoordinates
().
y
()
<
mesh
.
getDimensions
().
y
();
entity
.
getCoordinates
().
y
()
++
)
{
for
(
entity
.
getCoordinates
().
x
()
=
0
;
entity
.
getCoordinates
().
x
()
<=
mesh
.
getDimensions
().
x
();
entity
.
getCoordinates
().
x
()
++
)
{
entity
.
refresh
();
typename
MeshType
::
VertexType
v
=
entity
.
getCenter
();
str
<<
v
.
x
()
<<
" "
<<
v
.
y
()
<<
" "
<<
v
.
z
()
<<
" "
<<
function
.
getData
().
getElement
(
entity
.
getIndex
()
)
<<
std
::
endl
;
}
str
<<
std
::
endl
;
}
entity
.
setOrientation
(
EntityOrientation
(
0.0
,
1.0
,
0.0
)
);
for
(
entity
.
getCoordinates
().
z
()
=
0
;
entity
.
getCoordinates
().
z
()
<
mesh
.
getDimensions
().
z
();
entity
.
getCoordinates
().
z
()
++
)
for
(
entity
.
getCoordinates
().
x
()
=
0
;
entity
.
getCoordinates
().
x
()
<
mesh
.
getDimensions
().
x
();
entity
.
getCoordinates
().
x
()
++
)
{
for
(
entity
.
getCoordinates
().
y
()
=
0
;
entity
.
getCoordinates
().
y
()
<=
mesh
.
getDimensions
().
y
();
entity
.
getCoordinates
().
y
()
++
)
{
entity
.
refresh
();
typename
MeshType
::
VertexType
v
=
entity
.
getCenter
();
str
<<
v
.
x
()
<<
" "
<<
v
.
y
()
<<
" "
<<
v
.
z
()
<<
" "
<<
function
.
getData
().
getElement
(
entity
.
getIndex
()
)
<<
std
::
endl
;
}
str
<<
std
::
endl
;
}
entity
.
setOrientation
(
EntityOrientation
(
0.0
,
0.0
,
1.0
)
);
for
(
entity
.
getCoordinates
().
x
()
=
0
;
entity
.
getCoordinates
().
x
()
<
mesh
.
getDimensions
().
x
();
entity
.
getCoordinates
().
x
()
++
)
for
(
entity
.
getCoordinates
().
y
()
=
0
;
entity
.
getCoordinates
().
y
()
<=
mesh
.
getDimensions
().
y
();
entity
.
getCoordinates
().
y
()
++
)
{
for
(
entity
.
getCoordinates
().
z
()
=
0
;
entity
.
getCoordinates
().
z
()
<
mesh
.
getDimensions
().
z
();
entity
.
getCoordinates
().
z
()
++
)
{
entity
.
refresh
();
typename
MeshType
::
VertexType
v
=
entity
.
getCenter
();
str
<<
v
.
x
()
<<
" "
<<
v
.
y
()
<<
" "
<<
v
.
z
()
<<
" "
<<
function
.
getData
().
getElement
(
entity
.
getIndex
()
)
<<
std
::
endl
;
}
str
<<
std
::
endl
;
}
return
true
;
}
/****
* 3D grid, vertices
*/
template
<
typename
MeshReal
,
typename
Device
,
typename
MeshIndex
,
typename
Real
>
bool
MeshFunctionGnuplotWriter
<
MeshFunction
<
Meshes
::
Grid
<
3
,
MeshReal
,
Device
,
MeshIndex
>
,
0
,
Real
>
>::
write
(
const
MeshFunctionType
&
function
,
std
::
ostream
&
str
)
{
const
MeshType
&
mesh
=
function
.
getMesh
();
typename
MeshType
::
Vertex
entity
(
mesh
);
for
(
entity
.
getCoordinates
().
z
()
=
0
;
entity
.
getCoordinates
().
z
()
<=
mesh
.
getDimensions
().
z
();
entity
.
getCoordinates
().
z
()
++
)
for
(
entity
.
getCoordinates
().
y
()
=
0
;
entity
.
getCoordinates
().
y
()
<=
mesh
.
getDimensions
().
y
();
entity
.
getCoordinates
().
y
()
++
)
{
for
(
entity
.
getCoordinates
().
x
()
=
0
;
entity
.
getCoordinates
().
x
()
<=
mesh
.
getDimensions
().
x
();
entity
.
getCoordinates
().
x
()
++
)
{
entity
.
refresh
();
typename
MeshType
::
VertexType
v
=
entity
.
getCenter
();
str
<<
v
.
x
()
<<
" "
<<
v
.
y
()
<<
" "
<<
v
.
z
()
<<
" "
<<
function
.
getData
().
getElement
(
entity
.
getIndex
()
)
<<
std
::
endl
;
}
str
<<
std
::
endl
;
}
return
true
;
}
}
// namespace Functions
}
// 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