Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
waLBerla
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
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christian Vögl
waLBerla
Commits
49d76246
Commit
49d76246
authored
4 years ago
by
Sebastian Eibl
Browse files
Options
Downloads
Patches
Plain Diff
added missing Rot3 to VTK output
parent
532940dd
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mesa_pd/vtk/WriteOutput.h
+16
-0
16 additions, 0 deletions
src/mesa_pd/vtk/WriteOutput.h
src/vtk/VTKTrait.h
+9
-0
9 additions, 0 deletions
src/vtk/VTKTrait.h
tests/mesa_pd/vtk/VTKOutputs.cpp
+6
-2
6 additions, 2 deletions
tests/mesa_pd/vtk/VTKOutputs.cpp
with
31 additions
and
2 deletions
src/mesa_pd/vtk/WriteOutput.h
+
16
−
0
View file @
49d76246
...
@@ -59,6 +59,14 @@ void writeOutput(std::ostream& os, const Vec3& data, const uint_t component)
...
@@ -59,6 +59,14 @@ void writeOutput(std::ostream& os, const Vec3& data, const uint_t component)
walberla
::
vtk
::
toStream
(
os
,
data
[
component
]);
walberla
::
vtk
::
toStream
(
os
,
data
[
component
]);
}
}
template
<
>
inline
void
writeOutput
(
std
::
ostream
&
os
,
const
Rot3
&
data
,
const
uint_t
component
)
{
WALBERLA_ASSERT_LESS
(
component
,
3
);
walberla
::
vtk
::
toStream
(
os
,
(
data
.
getMatrix
()
*
Vec3
(
1
_r
,
0
_r
,
0
_r
))[
component
]);
}
template
<
typename
T
>
template
<
typename
T
>
inline
inline
void
writeOutput
(
walberla
::
vtk
::
Base64Writer
&
b64
,
const
T
&
data
,
const
uint_t
component
)
void
writeOutput
(
walberla
::
vtk
::
Base64Writer
&
b64
,
const
T
&
data
,
const
uint_t
component
)
...
@@ -85,6 +93,14 @@ void writeOutput(walberla::vtk::Base64Writer& b64, const Vec3& data, const uint_
...
@@ -85,6 +93,14 @@ void writeOutput(walberla::vtk::Base64Writer& b64, const Vec3& data, const uint_
b64
<<
data
[
component
];
b64
<<
data
[
component
];
}
}
template
<
>
inline
void
writeOutput
(
walberla
::
vtk
::
Base64Writer
&
b64
,
const
Rot3
&
data
,
const
uint_t
component
)
{
WALBERLA_ASSERT_LESS
(
component
,
3
);
b64
<<
(
data
.
getMatrix
()
*
Vec3
(
1
_r
,
0
_r
,
0
_r
))[
component
];
}
}
// namespace vtk
}
// namespace vtk
}
// namespace pe
}
// namespace pe
}
// namespace walberla
}
// namespace walberla
This diff is collapsed.
Click to expand it.
src/vtk/VTKTrait.h
+
9
−
0
View file @
49d76246
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#pragma once
#pragma once
#include
<core/DataTypes.h>
#include
<core/DataTypes.h>
#include
<core/math/Rot3.h>
#include
<core/math/Vector3.h>
#include
<core/math/Vector3.h>
namespace
walberla
{
namespace
walberla
{
...
@@ -117,5 +118,13 @@ struct VTKTrait<math::Vector3<T>>
...
@@ -117,5 +118,13 @@ struct VTKTrait<math::Vector3<T>>
constexpr
static
const
uint_t
components
=
3
;
constexpr
static
const
uint_t
components
=
3
;
};
};
template
<
typename
T
>
struct
VTKTrait
<
math
::
Rot3
<
T
>>
{
using
type
=
typename
VTKTrait
<
T
>::
type
;
constexpr
static
char
const
*
const
type_string
=
VTKTrait
<
T
>::
type_string
;
constexpr
static
const
uint_t
components
=
3
;
};
}
// namespace vtk
}
// namespace vtk
}
// namespace walberla
}
// namespace walberla
This diff is collapsed.
Click to expand it.
tests/mesa_pd/vtk/VTKOutputs.cpp
+
6
−
2
View file @
49d76246
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include
<core/Environment.h>
#include
<core/Environment.h>
#include
<core/grid_generator/SCIterator.h>
#include
<core/grid_generator/SCIterator.h>
#include
<core/logging/Logging.h>
#include
<core/logging/Logging.h>
#include
<core/math/Constants.h>
#include
<core/math/Random.h>
#include
<core/math/Random.h>
#include
<vtk/VTKOutput.h>
#include
<vtk/VTKOutput.h>
...
@@ -50,6 +51,8 @@ int main( int argc, char ** argv )
...
@@ -50,6 +51,8 @@ int main( int argc, char ** argv )
Vector3
<
uint_t
>
(
2
,
2
,
2
),
Vector3
<
uint_t
>
(
2
,
2
,
2
),
Vector3
<
bool
>
(
false
,
false
,
false
)
);
Vector3
<
bool
>
(
false
,
false
,
false
)
);
auto
rank
=
mpi
::
MPIManager
::
instance
()
->
rank
();
//initialize particles
//initialize particles
const
Vec3
shift
(
real_t
(
0.5
),
real_t
(
0.5
),
real_t
(
0.5
));
const
Vec3
shift
(
real_t
(
0.5
),
real_t
(
0.5
),
real_t
(
0.5
));
for
(
auto
&
iBlk
:
*
forest
)
for
(
auto
&
iBlk
:
*
forest
)
...
@@ -61,15 +64,16 @@ int main( int argc, char ** argv )
...
@@ -61,15 +64,16 @@ int main( int argc, char ** argv )
auto
p
=
ps
->
create
();
auto
p
=
ps
->
create
();
p
->
setPosition
(
pt
);
p
->
setPosition
(
pt
);
p
->
setOwner
(
mpi
::
MPIManager
::
instance
()
->
rank
()
);
p
->
setOwner
(
mpi
::
MPIManager
::
instance
()
->
rank
()
);
p
->
getRotationRef
().
rotate
(
Vec3
(
0
_r
,
1
_r
,
0
_r
),
real_c
(
rank
)
*
math
::
pi
*
0.5
_r
);
}
}
}
}
auto
vtkOutput
=
make_shared
<
mesa_pd
::
vtk
::
ParticleVtkOutput
>
(
ps
);
auto
vtkOutput
=
make_shared
<
mesa_pd
::
vtk
::
ParticleVtkOutput
>
(
ps
);
vtkOutput
->
addOutput
<
data
::
SelectParticleOwner
>
(
"owner"
);
vtkOutput
->
addOutput
<
data
::
SelectParticleOwner
>
(
"owner"
);
vtkOutput
->
addOutput
<
data
::
SelectParticleLinearVelocity
>
(
"velocity"
);
vtkOutput
->
addOutput
<
data
::
SelectParticleLinearVelocity
>
(
"velocity"
);
auto
rank
=
mpi
::
MPIManager
::
instance
()
->
rank
(
);
vtkOutput
->
addOutput
<
data
::
SelectParticleRotation
>
(
"rotation"
);
vtkOutput
->
setParticleSelector
(
[
rank
](
const
data
::
ParticleStorage
::
iterator
&
pIt
)
{
return
pIt
->
getIdx
()
<
uint_c
(
rank
);}
);
vtkOutput
->
setParticleSelector
(
[
rank
](
const
data
::
ParticleStorage
::
iterator
&
pIt
)
{
return
pIt
->
getIdx
()
<
uint_c
(
rank
);}
);
auto
vtkWriter
=
walberla
::
vtk
::
createVTKOutput_PointData
(
vtkOutput
,
"
Bodi
es"
,
1
,
"vtk"
,
"simulation_step"
,
false
,
false
);
auto
vtkWriter
=
walberla
::
vtk
::
createVTKOutput_PointData
(
vtkOutput
,
"
particl
es"
,
1
,
"vtk
_outputs
"
,
"simulation_step"
,
false
,
false
);
vtkWriter
->
write
();
vtkWriter
->
write
();
...
...
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