Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-gfe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sander, Oliver
dune-gfe
Commits
b29c7f4e
Commit
b29c7f4e
authored
10 years ago
by
Oliver Sander
Committed by
sander
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Write first-order configurations using the new VTKFile class instead of GeometryGrid
[[Imported from SVN: r9894]]
parent
36656a83
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/gfe/cosseratvtkwriter.hh
+55
-33
55 additions, 33 deletions
dune/gfe/cosseratvtkwriter.hh
with
55 additions
and
33 deletions
dune/gfe/cosseratvtkwriter.hh
+
55
−
33
View file @
b29c7f4e
...
@@ -304,55 +304,77 @@ public:
...
@@ -304,55 +304,77 @@ public:
vtkFile
.
write
(
filename
);
vtkFile
.
write
(
filename
);
#else // FIRST_ORDER
#else // FIRST_ORDER
typedef
typename
GridType
::
LeafGridView
GridView
;
const
GridType
&
grid
=
basis
.
getGridView
().
grid
(
);
Dune
::
GFE
::
VTKFile
vtkFile
(
gridView
.
comm
().
rank
(),
gridView
.
comm
().
size
()
);
//////////////////////////////////////////////////////////////////////////////////
// Stupid: I can't directly get the number of Interior_Partition elements
// Deform the grid according to the position information in 'configuration'
size_t
numElements
=
0
;
//////////////////////////////////////////////////////////////////////////////////
for
(
auto
it
=
gridView
.
template
begin
<
0
,
Dune
::
Interior_Partition
>();
it
!=
gridView
.
template
end
<
0
,
Dune
::
Interior_Partition
>();
++
it
)
numElements
++
;
typedef
Dune
::
GeometryGrid
<
GridType
,
DeformationFunction
<
GridView
>
>
DeformedGridType
;
// Enter vertex coordinates
std
::
vector
<
Dune
::
FieldVector
<
double
,
3
>
>
points
(
configuration
.
size
());
for
(
size_t
i
=
0
;
i
<
configuration
.
size
();
i
++
)
points
[
i
]
=
configuration
[
i
].
r
;
DeformationFunction
<
typename
GridType
::
LeafGridView
>
deformationFunction
(
grid
.
leafGridView
(),
configuration
)
;
vtkFile
.
points_
=
points
;
//
stupid, can't instantiate deformedGrid with a const grid
//
Enter elements
DeformedGridType
deformedGrid
(
const_cast
<
GridType
&>
(
grid
),
deformationFunction
);
std
::
vector
<
int
>
connectivity
(
numElements
*
4
);
typedef
P1NodalBasis
<
typename
DeformedGridType
::
LeafGridView
,
double
>
DeformedP1Basis
;
size_t
i
=
0
;
DeformedP1Basis
deformedP1Basis
(
deformedGrid
.
leafGridView
());
for
(
auto
it
=
gridView
.
template
begin
<
0
,
Dune
::
Interior_Partition
>();
it
!=
gridView
.
template
end
<
0
,
Dune
::
Interior_Partition
>();
++
it
)
{
if
(
it
->
type
().
isQuadrilateral
())
{
connectivity
[
i
++
]
=
basis
.
index
(
*
it
,
0
);
connectivity
[
i
++
]
=
basis
.
index
(
*
it
,
1
);
connectivity
[
i
++
]
=
basis
.
index
(
*
it
,
3
);
connectivity
[
i
++
]
=
basis
.
index
(
*
it
,
2
);
}
}
Dune
::
VTKWriter
<
typename
DeformedGridType
::
LeafGridView
>
vtkWriter
(
deformedGrid
.
leafGridView
())
;
vtkFile
.
cellConnectivity_
=
connectivity
;
// Make three vector fields containing the directors
std
::
vector
<
int
>
offsets
(
numElements
);
typedef
std
::
vector
<
Dune
::
FieldVector
<
double
,
3
>
>
CoefficientType
;
i
=
0
;
int
offsetCounter
=
0
;
for
(
auto
it
=
gridView
.
template
begin
<
0
>();
it
!=
gridView
.
template
end
<
0
>();
++
it
)
{
if
(
it
->
type
().
isQuadrilateral
())
offsetCounter
+=
4
;
offsets
[
i
++
]
+=
offsetCounter
;
}
std
::
vector
<
CoefficientType
>
directors
(
3
)
;
vtkFile
.
cellOffsets_
=
offsets
;
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
std
::
vector
<
int
>
cellTypes
(
numElements
);
i
=
0
;
for
(
auto
it
=
gridView
.
template
begin
<
0
>();
it
!=
gridView
.
template
end
<
0
>();
++
it
)
{
if
(
it
->
type
().
isQuadrilateral
())
cellTypes
[
i
++
]
=
9
;
}
vtkFile
.
cellTypes_
=
cellTypes
;
directors
[
i
].
resize
(
configuration
.
size
());
// Z coordinate for better visualization of wrinkles
for
(
size_t
j
=
0
;
j
<
configuration
.
size
();
j
++
)
std
::
vector
<
double
>
zCoord
(
points
.
size
());
directors
[
i
][
j
]
=
configuration
[
j
].
q
.
director
(
i
);
for
(
size_t
i
=
0
;
i
<
configuration
.
size
();
i
++
)
zCoord
[
i
]
=
configuration
[
i
].
r
[
2
];
std
::
stringstream
iAsAscii
;
vtkFile
.
zCoord_
=
zCoord
;
iAsAscii
<<
i
;
Dune
::
shared_ptr
<
VTKBasisGridFunction
<
DeformedP1Basis
,
CoefficientType
>
>
vtkDirector
// The three director fields
=
Dune
::
make_shared
<
VTKBasisGridFunction
<
DeformedP1Basis
,
CoefficientType
>
>
for
(
size_t
i
=
0
;
i
<
3
;
i
++
)
(
deformedP1Basis
,
directors
[
i
],
"director"
+
iAsAscii
.
str
());
{
vtkWriter
.
addVertexData
(
vtkDirector
);
vtkFile
.
directors_
[
i
].
resize
(
configuration
.
size
());
for
(
size_t
j
=
0
;
j
<
configuration
.
size
();
j
++
)
vtkFile
.
directors_
[
i
][
j
]
=
configuration
[
j
].
q
.
director
(
i
);
}
}
// For easier visualization of wrinkles: add z-coordinate as scalar field
// Actually write the VTK file to disk
std
::
vector
<
double
>
zCoord
(
configuration
.
size
());
vtkFile
.
write
(
filename
);
for
(
size_t
i
=
0
;
i
<
zCoord
.
size
();
i
++
)
zCoord
[
i
]
=
configuration
[
i
].
r
[
2
];
vtkWriter
.
addVertexData
(
zCoord
,
"zCoord"
);
// Write the file to disk
vtkWriter
.
write
(
filename
);
#endif
#endif
}
}
...
...
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