Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-alugrid
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
ag-ohlberger
dune-community
dune-alugrid
Commits
b2dacd37
Commit
b2dacd37
authored
12 years ago
by
Robert Kloefkorn
Browse files
Options
Downloads
Patches
Plain Diff
use duneAdapt and make loadBalance optional.
parent
9c085335
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
misc/examples/sizes.cc
+53
-12
53 additions, 12 deletions
misc/examples/sizes.cc
with
53 additions
and
12 deletions
misc/examples/sizes.cc
+
53
−
12
View file @
b2dacd37
...
...
@@ -30,6 +30,25 @@ using namespace std;
using
namespace
ALUGridSpace
;
struct
EmptyGatherScatter
:
public
GatherScatter
{
typedef
GatherScatter
::
ObjectStreamType
ObjectStreamType
;
EmptyGatherScatter
()
{}
virtual
void
inlineData
(
ObjectStreamType
&
str
,
HElemType
&
elem
)
{}
virtual
void
xtractData
(
ObjectStreamType
&
str
,
HElemType
&
elem
)
{}
};
struct
EmptyAdaptRestrictProlong
:
public
Gitter
::
AdaptRestrictProlong
{
virtual
int
preCoarsening
(
HElemType
&
elem
)
{
return
1
;
}
virtual
int
postRefinement
(
HElemType
&
elem
)
{
return
1
;
}
virtual
int
preCoarsening
(
HGhostType
&
bnd
)
{
return
1
;
}
virtual
int
postRefinement
(
HGhostType
&
bnd
)
{
return
1
;
}
};
// refine grid globally, i.e. mark all elements and then call adapt
template
<
class
GitterType
>
bool
needConformingClosure
(
GitterType
&
grid
,
bool
useClosure
)
...
...
@@ -49,6 +68,7 @@ bool needConformingClosure( GitterType& grid, bool useClosure )
}
return
needClosure
;
}
// refine grid globally, i.e. mark all elements and then call adapt
template
<
class
GitterType
>
...
...
@@ -92,8 +112,12 @@ void checkRefinements( GitterType& grid )
}
}
// create empty gather scatter
EmptyAdaptRestrictProlong
rp
;
// adapt grid
grid
.
adapt
();
grid
.
duneAdapt
(
rp
);
// coarsen again
globalCoarsening
(
grid
,
1
);
...
...
@@ -106,7 +130,8 @@ void checkRefinements( GitterType& grid )
// refine grid globally, i.e. mark all elements and then call adapt
template
<
class
GitterType
>
void
globalRefine
(
GitterType
&
grid
,
bool
global
,
int
step
,
const
bool
bisection
=
true
)
void
globalRefine
(
GitterType
&
grid
,
bool
global
,
int
step
,
int
mxl
,
const
bool
loadBalance
=
false
)
{
{
if
(
global
)
...
...
@@ -119,11 +144,8 @@ void globalRefine(GitterType& grid, bool global, int step, const bool bisection
// mark element for refinement
w
->
item
().
tagForGlobalRefinement
();
}
// adapt grid
grid
.
adapt
();
grid
.
printsize
()
;
}
else
else
{
double
t
=
double
(
step
)
/
10.
;
double
center
[
3
]
=
{
0.2
,
0.2
,
0.2
};
...
...
@@ -132,8 +154,22 @@ void globalRefine(GitterType& grid, bool global, int step, const bool bisection
center
[
1
]
+=
dir
[
1
]
*
t
;
center
[
2
]
+=
dir
[
2
]
*
t
;
double
rad
=
0.6
;
grid
.
refineBall
(
center
,
rad
,
10
);
grid
.
markForBallRefinement
(
center
,
rad
,
mxl
);
}
// create empty gather scatter
EmptyAdaptRestrictProlong
rp
;
// adapt grid
grid
.
duneAdapt
(
rp
);
if
(
loadBalance
)
{
// load balance
grid
.
duneLoadBalance
();
}
// print size of grid
grid
.
printsize
()
;
}
...
...
@@ -159,8 +195,11 @@ void globalCoarsening(GitterType& grid, int refcount) {
}
}
// create empty gather scatter
EmptyAdaptRestrictProlong
rp
;
// adapt grid
grid
.
adapt
(
);
grid
.
duneAdapt
(
rp
);
// print size of grid
grid
.
printsize
()
;
...
...
@@ -253,27 +292,29 @@ int main (int argc, char ** argv, const char ** envp)
grid
.
printMemUsage
();
for
(
int
i
=
0
;
i
<
glb
;
++
i
)
globalRefine
(
grid
,
true
,
-
1
);
globalRefine
(
grid
,
true
,
-
1
,
mxl
);
for
(
int
i
=
0
;
i
<
glb
;
++
i
)
globalRefine
(
grid
,
false
,
0
);
for
(
int
i
=
0
;
i
<
mxl
;
++
i
)
globalRefine
(
grid
,
false
,
0
,
mxl
);
for
(
int
i
=
0
;
i
<
2
*
mxl
;
++
i
)
{
std
::
ostringstream
ss
;
ss
<<
"out-"
<<
ZeroPadNumber
(
i
)
<<
".vtu"
;
grid
.
tovtk
(
ss
.
str
().
c_str
()
);
globalRefine
(
grid
,
false
,
i
);
globalRefine
(
grid
,
false
,
i
,
mxl
);
}
{
std
::
ostringstream
ss
;
ss
<<
"out-"
<<
ZeroPadNumber
(
mxl
)
<<
".vtu"
;
grid
.
tovtk
(
ss
.
str
().
c_str
()
);
}
/*
globalCoarsening(grid,3*glb);
{
std::ostringstream ss;
ss << "out-" << ZeroPadNumber(mxl+1) << ".vtu";
grid.tovtk( ss.str().c_str() );
}
*/
}
}
...
...
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