Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Schruff
waLBerla
Commits
7a60a54f
Commit
7a60a54f
authored
Feb 19, 2018
by
Sebastian Eibl
Browse files
added sid and uid data source for pe
extended VTKMeshWriter to support uint64_t
parent
fd1406eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/mesh/pe/vtk/CommonDataSources.h
View file @
7a60a54f
...
...
@@ -38,6 +38,115 @@ namespace walberla {
namespace
mesh
{
namespace
pe
{
template
<
typename
MeshType
,
typename
Tesselation
,
typename
OutputType
=
uint64_t
>
class
SIDVertexDataSource
:
public
PeVTKMeshWriter
<
MeshType
,
Tesselation
>::
template
VertexDataSource
<
OutputType
>
{
public:
typedef
typename
PeVTKMeshWriter
<
MeshType
,
Tesselation
>::
template
VertexDataSource
<
OutputType
>
Base
;
typedef
typename
Base
::
Vertices
Vertices
;
typedef
typename
Base
::
value_type
value_type
;
typedef
typename
Base
::
BodyPointerVPropManager
BodyPointerVPropManager
;
SIDVertexDataSource
(
const
std
::
string
&
_name
=
"sid"
)
:
Base
(
_name
)
{
}
virtual
uint_t
numComponents
()
{
return
uint_t
(
1
);
}
virtual
void
getData
(
const
MeshType
&
/*mesh*/
,
const
Vertices
&
vertices
,
std
::
vector
<
value_type
>
&
data
,
const
BodyPointerVPropManager
&
bodyPointer
)
{
data
.
reserve
(
vertices
.
size
()
);
for
(
auto
it
=
vertices
.
begin
();
it
!=
vertices
.
end
();
++
it
)
{
const
auto
&
v
=
bodyPointer
[
*
it
]
->
getSystemID
();
data
.
push_back
(
numeric_cast
<
OutputType
>
(
v
)
);
}
}
};
template
<
typename
MeshType
,
typename
Tesselation
,
typename
OutputType
=
uint64_t
>
class
SIDFaceDataSource
:
public
PeVTKMeshWriter
<
MeshType
,
Tesselation
>::
template
FaceDataSource
<
OutputType
>
{
public:
typedef
typename
PeVTKMeshWriter
<
MeshType
,
Tesselation
>::
template
FaceDataSource
<
OutputType
>
Base
;
typedef
typename
Base
::
Faces
Faces
;
typedef
typename
Base
::
value_type
value_type
;
typedef
typename
Base
::
BodyPointerFPropManager
BodyPointerFPropManager
;
SIDFaceDataSource
(
const
std
::
string
&
_name
=
"sid"
)
:
Base
(
_name
)
{
}
virtual
uint_t
numComponents
()
{
return
uint_t
(
1
);
}
virtual
void
getData
(
const
MeshType
&
/*mesh*/
,
const
Faces
&
faces
,
std
::
vector
<
value_type
>
&
data
,
const
BodyPointerFPropManager
&
bodyPointer
)
{
data
.
reserve
(
faces
.
size
()
);
for
(
auto
it
=
faces
.
begin
();
it
!=
faces
.
end
();
++
it
)
{
const
auto
&
v
=
bodyPointer
[
*
it
]
->
getSystemID
();
data
.
push_back
(
numeric_cast
<
OutputType
>
(
v
)
);
}
}
};
template
<
typename
MeshType
,
typename
Tesselation
,
typename
OutputType
=
uint64_t
>
class
UIDVertexDataSource
:
public
PeVTKMeshWriter
<
MeshType
,
Tesselation
>::
template
VertexDataSource
<
OutputType
>
{
public:
typedef
typename
PeVTKMeshWriter
<
MeshType
,
Tesselation
>::
template
VertexDataSource
<
OutputType
>
Base
;
typedef
typename
Base
::
Vertices
Vertices
;
typedef
typename
Base
::
value_type
value_type
;
typedef
typename
Base
::
BodyPointerVPropManager
BodyPointerVPropManager
;
UIDVertexDataSource
(
const
std
::
string
&
_name
=
"uid"
)
:
Base
(
_name
)
{
}
virtual
uint_t
numComponents
()
{
return
uint_t
(
1
);
}
virtual
void
getData
(
const
MeshType
&
/*mesh*/
,
const
Vertices
&
vertices
,
std
::
vector
<
value_type
>
&
data
,
const
BodyPointerVPropManager
&
bodyPointer
)
{
data
.
reserve
(
vertices
.
size
()
);
for
(
auto
it
=
vertices
.
begin
();
it
!=
vertices
.
end
();
++
it
)
{
const
auto
&
v
=
bodyPointer
[
*
it
]
->
getID
();
data
.
push_back
(
numeric_cast
<
OutputType
>
(
v
)
);
}
}
};
template
<
typename
MeshType
,
typename
Tesselation
,
typename
OutputType
=
uint64_t
>
class
UIDFaceDataSource
:
public
PeVTKMeshWriter
<
MeshType
,
Tesselation
>::
template
FaceDataSource
<
OutputType
>
{
public:
typedef
typename
PeVTKMeshWriter
<
MeshType
,
Tesselation
>::
template
FaceDataSource
<
OutputType
>
Base
;
typedef
typename
Base
::
Faces
Faces
;
typedef
typename
Base
::
value_type
value_type
;
typedef
typename
Base
::
BodyPointerFPropManager
BodyPointerFPropManager
;
UIDFaceDataSource
(
const
std
::
string
&
_name
=
"uid"
)
:
Base
(
_name
)
{
}
virtual
uint_t
numComponents
()
{
return
uint_t
(
1
);
}
virtual
void
getData
(
const
MeshType
&
/*mesh*/
,
const
Faces
&
faces
,
std
::
vector
<
value_type
>
&
data
,
const
BodyPointerFPropManager
&
bodyPointer
)
{
data
.
reserve
(
faces
.
size
()
);
for
(
auto
it
=
faces
.
begin
();
it
!=
faces
.
end
();
++
it
)
{
const
auto
&
v
=
bodyPointer
[
*
it
]
->
getID
();
data
.
push_back
(
numeric_cast
<
OutputType
>
(
v
)
);
}
}
};
template
<
typename
MeshType
,
typename
Tesselation
,
typename
OutputType
=
real_t
>
class
LinearVelocityVertexDataSource
:
public
PeVTKMeshWriter
<
MeshType
,
Tesselation
>::
template
VertexDataSource
<
OutputType
>
{
...
...
@@ -190,4 +299,4 @@ public:
}
// namespace pe
}
// namespace mesh
}
// namespace walberla
\ No newline at end of file
}
// namespace walberla
src/mesh/vtk/VTKMeshWriter.h
View file @
7a60a54f
...
...
@@ -90,11 +90,13 @@ public:
inline
void
addDataSource
(
const
shared_ptr
<
VertexDataSource
<
double
>
>
&
dataSource
)
{
doubleVertexDataSources_
.
push_back
(
dataSource
);
}
inline
void
addDataSource
(
const
shared_ptr
<
VertexDataSource
<
int32_t
>
>
&
dataSource
)
{
int32VertexDataSources_
.
push_back
(
dataSource
);
}
inline
void
addDataSource
(
const
shared_ptr
<
VertexDataSource
<
uint8_t
>
>
&
dataSource
)
{
uint8VertexDataSources_
.
push_back
(
dataSource
);
}
inline
void
addDataSource
(
const
shared_ptr
<
VertexDataSource
<
uint64_t
>
>
&
dataSource
)
{
uint64VertexDataSources_
.
push_back
(
dataSource
);
}
inline
void
addDataSource
(
const
shared_ptr
<
FaceDataSource
<
float
>
>
&
dataSource
)
{
floatFaceDataSources_
.
push_back
(
dataSource
);
}
inline
void
addDataSource
(
const
shared_ptr
<
FaceDataSource
<
double
>
>
&
dataSource
)
{
doubleFaceDataSources_
.
push_back
(
dataSource
);
}
inline
void
addDataSource
(
const
shared_ptr
<
FaceDataSource
<
int32_t
>
>
&
dataSource
)
{
int32FaceDataSources_
.
push_back
(
dataSource
);
}
inline
void
addDataSource
(
const
shared_ptr
<
FaceDataSource
<
uint8_t
>
>
&
dataSource
)
{
uint8FaceDataSources_
.
push_back
(
dataSource
);
}
inline
void
addDataSource
(
const
shared_ptr
<
FaceDataSource
<
uint64_t
>
>
&
dataSource
)
{
uint64FaceDataSources_
.
push_back
(
dataSource
);
}
inline
void
setFaceFilter
(
const
FaceFilterFunction
&
f
)
{
faceFilter_
=
f
;
}
inline
void
clearFaceFilter
()
{
faceFilter_
=
FaceFilterFunction
();
}
...
...
@@ -127,15 +129,17 @@ protected:
FaceFilterFunction
faceFilter_
;
std
::
vector
<
shared_ptr
<
VertexDataSource
<
float
>
>
>
floatVertexDataSources_
;
std
::
vector
<
shared_ptr
<
VertexDataSource
<
double
>
>
>
doubleVertexDataSources_
;
std
::
vector
<
shared_ptr
<
VertexDataSource
<
int32_t
>
>
>
int32VertexDataSources_
;
std
::
vector
<
shared_ptr
<
VertexDataSource
<
uint8_t
>
>
>
uint8VertexDataSources_
;
std
::
vector
<
shared_ptr
<
FaceDataSource
<
float
>
>
>
floatFaceDataSources_
;
std
::
vector
<
shared_ptr
<
FaceDataSource
<
double
>
>
>
doubleFaceDataSources_
;
std
::
vector
<
shared_ptr
<
FaceDataSource
<
int32_t
>
>
>
int32FaceDataSources_
;
std
::
vector
<
shared_ptr
<
FaceDataSource
<
uint8_t
>
>
>
uint8FaceDataSources_
;
std
::
vector
<
shared_ptr
<
VertexDataSource
<
float
>
>
>
floatVertexDataSources_
;
std
::
vector
<
shared_ptr
<
VertexDataSource
<
double
>
>
>
doubleVertexDataSources_
;
std
::
vector
<
shared_ptr
<
VertexDataSource
<
int32_t
>
>
>
int32VertexDataSources_
;
std
::
vector
<
shared_ptr
<
VertexDataSource
<
uint8_t
>
>
>
uint8VertexDataSources_
;
std
::
vector
<
shared_ptr
<
VertexDataSource
<
uint64_t
>
>
>
uint64VertexDataSources_
;
std
::
vector
<
shared_ptr
<
FaceDataSource
<
float
>
>
>
floatFaceDataSources_
;
std
::
vector
<
shared_ptr
<
FaceDataSource
<
double
>
>
>
doubleFaceDataSources_
;
std
::
vector
<
shared_ptr
<
FaceDataSource
<
int32_t
>
>
>
int32FaceDataSources_
;
std
::
vector
<
shared_ptr
<
FaceDataSource
<
uint8_t
>
>
>
uint8FaceDataSources_
;
std
::
vector
<
shared_ptr
<
FaceDataSource
<
uint64_t
>
>
>
uint64FaceDataSources_
;
};
...
...
@@ -303,19 +307,21 @@ void VTKMeshWriter<MeshType>::writePiece( std::ostream & os ) const
os
<<
" <CellData>
\n
"
;
writeFaceData
(
floatFaceDataSources_
,
faces
,
os
,
b64
);
writeFaceData
(
doubleFaceDataSources_
,
faces
,
os
,
b64
);
writeFaceData
(
int32FaceDataSources_
,
faces
,
os
,
b64
);
writeFaceData
(
uint8FaceDataSources_
,
faces
,
os
,
b64
);
writeFaceData
(
floatFaceDataSources_
,
faces
,
os
,
b64
);
writeFaceData
(
doubleFaceDataSources_
,
faces
,
os
,
b64
);
writeFaceData
(
int32FaceDataSources_
,
faces
,
os
,
b64
);
writeFaceData
(
uint8FaceDataSources_
,
faces
,
os
,
b64
);
writeFaceData
(
uint64FaceDataSources_
,
faces
,
os
,
b64
);
os
<<
" </CellData>
\n
"
;
os
<<
" <PointData>
\n
"
;
writeVertexData
(
floatVertexDataSources_
,
vertices
,
os
,
b64
);
writeVertexData
(
doubleVertexDataSources_
,
vertices
,
os
,
b64
);
writeVertexData
(
int32VertexDataSources_
,
vertices
,
os
,
b64
);
writeVertexData
(
uint8VertexDataSources_
,
vertices
,
os
,
b64
);
writeVertexData
(
floatVertexDataSources_
,
vertices
,
os
,
b64
);
writeVertexData
(
doubleVertexDataSources_
,
vertices
,
os
,
b64
);
writeVertexData
(
int32VertexDataSources_
,
vertices
,
os
,
b64
);
writeVertexData
(
uint8VertexDataSources_
,
vertices
,
os
,
b64
);
writeVertexData
(
uint64VertexDataSources_
,
vertices
,
os
,
b64
);
os
<<
" </PointData>
\n
"
;
...
...
@@ -376,4 +382,4 @@ void VTKMeshWriter<MeshType>::operator()()
}
// namespace mesh
}
// namespace walberla
\ No newline at end of file
}
// namespace walberla
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