Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-metagrid
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
extensions
dune-metagrid
Commits
67ad672b
Commit
67ad672b
authored
6 years ago
by
Robert K
Browse files
Options
Downloads
Patches
Plain Diff
[cleanup] sfc --> test-sfc.
parent
e7cc59c1
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
dune/grid/test/CMakeLists.txt
+1
-1
1 addition, 1 deletion
dune/grid/test/CMakeLists.txt
dune/grid/test/test-sfc.cc
+83
-0
83 additions, 0 deletions
dune/grid/test/test-sfc.cc
with
84 additions
and
1 deletion
dune/grid/test/CMakeLists.txt
+
1
−
1
View file @
67ad672b
...
...
@@ -5,7 +5,7 @@ set(WORLDDIM ${GRIDDIM})
set
(
METAGRIDS idgrid
)
# set(METAGRIDS idgrid,idgrid,idgrid)
set
(
TESTS test-cacheitgrid test-cartesiangrid test-filteredgrid test-idgrid test-metagrids test-parallelgrid test-spheregrid sfc
)
set
(
TESTS test-cacheitgrid test-cartesiangrid test-filteredgrid test-idgrid test-metagrids test-parallelgrid test-spheregrid
test-
sfc
)
foreach
(
_executable
${
TESTS
}
)
dune_add_test
(
NAME
${
_executable
}
SOURCES
${
_executable
}
.cc
)
...
...
This diff is collapsed.
Click to expand it.
dune/grid/test/test-sfc.cc
0 → 100644
+
83
−
0
View file @
67ad672b
#include
<config.h>
// iostream includes
#include
<iostream>
#include
<fstream>
#include
<vector>
#include
<dune/common/mpihelper.hh>
#include
<dune/grid/io/file/dgfparser/dgfyasp.hh>
#include
<dune/grid/yaspgrid.hh>
#include
<dune/grid/parallelgrid/sfciterator.hh>
// print space filling curve
template
<
class
HGridType
>
void
printCurve
(
HGridType
&
grid
,
std
::
ostream
&
out
)
{
typedef
typename
HGridType
::
LeafGridView
LeafView
;
typedef
typename
HGridType
::
template
Codim
<
0
>
::
Geometry
Geometry
;
int
count
=
0
;
Dune
::
SpaceFillingCurveIterator
<
LeafView
>
it
(
grid
.
leafGridView
()
);
for
(
it
.
first
();
!
it
.
done
();
it
.
next
(),
++
count
)
{
const
Geometry
&
geo
=
it
.
item
().
geometry
();
out
<<
geo
.
center
()
<<
std
::
endl
;
}
if
(
count
!=
grid
.
size
(
0
)
)
DUNE_THROW
(
Dune
::
InvalidStateException
,
"SFC iterator worng"
);
}
// print space filling curve
template
<
class
HGridType
>
void
printGrid
(
HGridType
&
grid
,
std
::
ostream
&
out
)
{
typedef
typename
HGridType
::
LeafGridView
LeafView
;
typedef
typename
HGridType
::
template
Codim
<
0
>
::
Geometry
Geometry
;
Dune
::
SpaceFillingCurveIterator
<
LeafView
>
it
(
grid
.
leafGridView
()
);
for
(
it
.
first
();
!
it
.
done
();
it
.
next
()
)
{
const
Geometry
&
geo
=
it
.
item
().
geometry
();
const
int
corners
=
geo
.
corners
();
for
(
int
i
=
0
;
i
<
corners
;
++
i
)
out
<<
geo
.
corner
(
i
)
<<
std
::
endl
;
}
}
// main
// ----
int
main
(
int
argc
,
char
**
argv
)
try
{
// initialize MPI, if necessary
Dune
::
MPIHelper
::
instance
(
argc
,
argv
);
// type of hierarchical grid
//typedef Dune :: AlbertaGrid< 2 , 2 > GridType;
typedef
Dune
::
YaspGrid
<
3
>
HGridType
;
//typedef Dune :: GridSelector :: GridType HGridType ;
std
::
string
gridfile
(
"3dcube.dgf"
);
// construct macro using the DGF Parser
Dune
::
GridPtr
<
HGridType
>
gridPtr
(
gridfile
);
HGridType
&
grid
=
*
gridPtr
;
std
::
ofstream
file
(
"curve.gnu"
);
printCurve
(
grid
,
file
);
std
::
ofstream
gridout
(
"grid.gnu"
);
printGrid
(
grid
,
gridout
);
return
0
;
}
catch
(
const
Dune
::
Exception
&
exception
)
{
std
::
cerr
<<
"Error: "
<<
exception
<<
std
::
endl
;
return
1
;
}
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