Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-fufem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Ansgar Burchardt
dune-fufem
Commits
633a40c1
Commit
633a40c1
authored
9 years ago
by
Jonathan Youett
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup using range-based for-loops
parent
ce2ed688
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/fufem/boundarywriter.hh
+20
-30
20 additions, 30 deletions
dune/fufem/boundarywriter.hh
with
20 additions
and
30 deletions
dune/fufem/boundarywriter.hh
+
20
−
30
View file @
633a40c1
...
...
@@ -11,6 +11,7 @@
template
<
class
GridView
>
void
writeBoundary
(
const
BoundaryPatch
<
GridView
>&
surface
,
const
std
::
string
&
filename
)
{
typedef
typename
GridView
::
ctype
field_type
;
enum
{
dim
=
GridView
::
dimension
};
const
GridView
&
gv
=
surface
.
gridView
();
...
...
@@ -58,17 +59,12 @@ void writeBoundary(const BoundaryPatch<GridView>& surface, const std::string& fi
fprintf
(
fp
,
"
\n
Vertices %lu
\n
"
,
surfVertices
.
count
());
typedef
typename
GridView
::
template
Codim
<
dim
>
::
Iterator
VertexIterator
;
VertexIterator
vIt
=
gv
.
template
begin
<
dim
>();
VertexIterator
vEndIt
=
gv
.
template
end
<
dim
>();
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
dim
>
>
coords
(
gv
.
size
(
dim
));
Dune
::
BlockVector
<
Dune
::
FieldVector
<
field_type
,
dim
>
>
coords
(
gv
.
size
(
dim
));
// resort the relevant coordinates so they appear ordered by their entities' indices
for
(
;
vIt
!=
vEndIt
;
++
vIt
)
if
(
surfVertices
[
indexSet
.
index
(
*
vIt
)][
0
])
coords
[
indexSet
.
index
(
*
vIt
)]
=
v
It
->
geometry
().
corner
(
0
);
for
(
const
auto
&
v
:
vertices
(
gv
)
)
if
(
surfVertices
[
indexSet
.
index
(
v
)][
0
])
coords
[
indexSet
.
index
(
v
)]
=
v
.
geometry
().
corner
(
0
);
// write coordinates
for
(
size_t
i
=
0
;
i
<
coords
.
size
();
i
++
)
...
...
@@ -94,13 +90,11 @@ void writeBoundary(const BoundaryPatch<GridView>& surface, const std::string& fi
// quadrilaterals need to be transformed to two triangles because
// Amira doesn't know quadrilateral surface :-(((
int
numFaces
=
0
;
// loop over all elements
typename
BoundaryPatch
<
GridView
>::
iterator
it
=
surface
.
begin
();
typename
BoundaryPatch
<
GridView
>::
iterator
endIt
=
surface
.
end
();
for
(;
it
!=
endIt
;
++
it
)
{
// loop over all elements
for
(
const
auto
it
:
surface
)
{
switch
(
it
->
geometry
().
corners
())
{
switch
(
it
.
geometry
().
corners
())
{
case
3
:
numFaces
++
;
break
;
...
...
@@ -116,25 +110,24 @@ void writeBoundary(const BoundaryPatch<GridView>& surface, const std::string& fi
fprintf
(
fp
,
"Triangles %d
\n
"
,
numFaces
);
// loop over all elements
it
=
surface
.
begin
();
for
(
const
auto
it
:
surface
)
{
for
(;
it
!=
endIt
;
++
it
)
{
const
auto
&
inside
=
it
.
inside
();
const
Dune
::
ReferenceElement
<
double
,
dim
>&
refElement
=
Dune
::
ReferenceElements
<
double
,
dim
>::
general
(
it
->
inside
()
->
type
());
const
auto
&
refElement
=
Dune
::
ReferenceElements
<
field_type
,
dim
>::
general
(
inside
.
type
());
int
n
=
refElement
.
size
(
it
->
indexInInside
(),
1
,
dim
);
int
n
=
refElement
.
size
(
it
.
indexInInside
(),
1
,
dim
);
fprintf
(
fp
,
" %d %d %d
\n
"
,
globalToLocal
[
indexSet
.
subIndex
(
*
it
->
inside
()
,
refElement
.
subEntity
(
it
->
indexInInside
(),
1
,
0
,
dim
),
dim
)]
+
1
,
globalToLocal
[
indexSet
.
subIndex
(
*
it
->
inside
()
,
refElement
.
subEntity
(
it
->
indexInInside
(),
1
,
1
,
dim
),
dim
)]
+
1
,
globalToLocal
[
indexSet
.
subIndex
(
*
it
->
inside
()
,
refElement
.
subEntity
(
it
->
indexInInside
(),
1
,
2
,
dim
),
dim
)]
+
1
);
globalToLocal
[
indexSet
.
subIndex
(
inside
,
refElement
.
subEntity
(
it
.
indexInInside
(),
1
,
0
,
dim
),
dim
)]
+
1
,
globalToLocal
[
indexSet
.
subIndex
(
inside
,
refElement
.
subEntity
(
it
.
indexInInside
(),
1
,
1
,
dim
),
dim
)]
+
1
,
globalToLocal
[
indexSet
.
subIndex
(
inside
,
refElement
.
subEntity
(
it
.
indexInInside
(),
1
,
2
,
dim
),
dim
)]
+
1
);
if
(
n
==
4
)
fprintf
(
fp
,
" %d %d %d
\n
"
,
globalToLocal
[
indexSet
.
subIndex
(
*
it
->
inside
()
,
refElement
.
subEntity
(
it
->
indexInInside
(),
1
,
2
,
dim
),
dim
)]
+
1
,
globalToLocal
[
indexSet
.
subIndex
(
*
it
->
inside
()
,
refElement
.
subEntity
(
it
->
indexInInside
(),
1
,
3
,
dim
),
dim
)]
+
1
,
globalToLocal
[
indexSet
.
subIndex
(
*
it
->
inside
()
,
refElement
.
subEntity
(
it
->
indexInInside
(),
1
,
0
,
dim
),
dim
)]
+
1
);
globalToLocal
[
indexSet
.
subIndex
(
inside
,
refElement
.
subEntity
(
it
.
indexInInside
(),
1
,
2
,
dim
),
dim
)]
+
1
,
globalToLocal
[
indexSet
.
subIndex
(
inside
,
refElement
.
subEntity
(
it
.
indexInInside
(),
1
,
3
,
dim
),
dim
)]
+
1
,
globalToLocal
[
indexSet
.
subIndex
(
inside
,
refElement
.
subEntity
(
it
.
indexInInside
(),
1
,
0
,
dim
),
dim
)]
+
1
);
}
...
...
@@ -212,11 +205,8 @@ void writeLineSet(const BoundaryPatch<GridView>& surface, const std::string& fil
fgrid
<<
"
\n
"
;
fgrid
<<
"@2
\n
"
;
typename
BoundaryPatch
<
GridView
>::
iterator
it
=
surface
.
begin
();
typename
BoundaryPatch
<
GridView
>::
iterator
itEnd
=
surface
.
end
();
for
(;
it
!=
itEnd
;
++
it
)
{
auto
geom
=
it
->
geometry
();
for
(
const
auto
&
it
:
surface
)
{
auto
geom
=
it
.
geometry
();
for
(
int
i
=
0
;
i
<
2
;
++
i
)
fgrid
<<
geom
.
corner
(
i
)
<<
" "
<<
0
<<
"
\n
"
;
}
...
...
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