Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
amdis
amdis-core
Commits
c3dc225d
Commit
c3dc225d
authored
Apr 26, 2019
by
Praetorius, Simon
Browse files
added Environment for MPI initialization
parent
73513f33
Changes
38
Show whitespace changes
Inline
Side-by-side
examples/boundary.cc
View file @
c3dc225d
...
...
@@ -95,7 +95,7 @@ void run_periodic()
int
main
(
int
argc
,
char
**
argv
)
{
AMDiS
::
init
(
argc
,
argv
);
Environment
env
(
argc
,
argv
);
auto
b
=
[](
auto
const
&
x
){
return
x
[
0
]
<
1.e-8
||
x
[
1
]
<
1.e-8
||
x
[
0
]
>
1.0
-
1.e-8
||
x
[
1
]
>
1.0
-
1.e-8
;
};
...
...
@@ -119,6 +119,5 @@ int main(int argc, char** argv)
run_periodic
();
AMDiS
::
finalize
();
return
0
;
}
examples/cahn_hilliard.cc
View file @
c3dc225d
...
...
@@ -13,7 +13,7 @@ using Param = LagrangeBasis<Grid, 1, 1>;
int
main
(
int
argc
,
char
**
argv
)
{
AMDiS
::
init
(
argc
,
argv
);
Environment
env
(
argc
,
argv
);
ProblemStat
<
Param
>
prob
(
"ch"
);
prob
.
initialize
(
INIT_ALL
);
...
...
@@ -68,6 +68,5 @@ int main(int argc, char** argv)
AdaptInstationary
adapt
(
"adapt"
,
prob
,
adaptInfo
,
probInstat
,
adaptInfo
);
adapt
.
adapt
();
AMDiS
::
finalize
();
return
0
;
}
examples/convection_diffusion.cc
View file @
c3dc225d
...
...
@@ -17,7 +17,7 @@ using ElliptProblem = ProblemStat<ElliptParam>;
int
main
(
int
argc
,
char
**
argv
)
{
AMDiS
::
init
(
argc
,
argv
);
Environment
env
(
argc
,
argv
);
using
namespace
Dune
::
Indices
;
...
...
@@ -39,6 +39,5 @@ int main(int argc, char** argv)
prob
.
solve
(
adaptInfo
);
prob
.
writeFiles
(
adaptInfo
,
true
);
AMDiS
::
finalize
();
return
0
;
}
examples/ellipt.cc
View file @
c3dc225d
...
...
@@ -18,7 +18,7 @@ using ElliptProblem = ProblemStat<Param>;
int
main
(
int
argc
,
char
**
argv
)
{
AMDiS
::
init
(
argc
,
argv
);
Environment
env
(
argc
,
argv
);
int
numLevels
=
GRIDDIM
==
2
?
8
:
5
;
if
(
argc
>
2
)
...
...
@@ -92,6 +92,5 @@ int main(int argc, char** argv)
msg
(
"{:<5} | {:<12} | {:<12} | {:<12} | {:<12} | {:<12}"
,
i
+
1
,
widths
[
i
],
errL2
[
i
],
errH1
[
i
],
eocL2
[
i
],
eocH1
[
i
]);
AMDiS
::
finalize
();
return
0
;
}
examples/heat.cc
View file @
c3dc225d
...
...
@@ -21,7 +21,7 @@ using HeatProblemInstat = ProblemInstat<HeatParam>;
int
main
(
int
argc
,
char
**
argv
)
{
AMDiS
::
init
(
argc
,
argv
);
Environment
env
(
argc
,
argv
);
HeatProblem
prob
(
"heat"
);
prob
.
initialize
(
INIT_ALL
);
...
...
@@ -55,6 +55,5 @@ int main(int argc, char** argv)
AdaptInstationary
adapt
(
"adapt"
,
prob
,
adaptInfo
,
probInstat
,
adaptInfo
);
adapt
.
adapt
();
AMDiS
::
finalize
();
return
0
;
}
examples/navier_stokes.cc
View file @
c3dc225d
...
...
@@ -12,7 +12,7 @@ using Basis = TaylorHoodBasis<Grid>;
int
main
(
int
argc
,
char
**
argv
)
{
AMDiS
::
init
(
argc
,
argv
);
Environment
env
(
argc
,
argv
);
ProblemStat
<
Basis
>
prob
(
"stokes"
);
prob
.
initialize
(
INIT_ALL
);
...
...
@@ -89,6 +89,5 @@ int main(int argc, char** argv)
// output solution
prob
.
writeFiles
(
adaptInfo
);
AMDiS
::
finalize
();
return
0
;
}
examples/neumann.cc
View file @
c3dc225d
...
...
@@ -51,7 +51,7 @@ void run(Grid& grid)
int
main
(
int
argc
,
char
**
argv
)
{
AMDiS
::
init
(
argc
,
argv
);
Environment
env
(
argc
,
argv
);
// 2d grids
...
...
@@ -85,6 +85,5 @@ int main(int argc, char** argv)
Dune
::
YaspGrid
<
3
>
grid4
({
1.0
,
1.0
,
1.0
},{
2
,
2
,
2
});
run
(
grid4
);
AMDiS
::
finalize
();
return
0
;
}
examples/periodic.cc
View file @
c3dc225d
...
...
@@ -79,7 +79,7 @@ void run(Grid& grid)
int
main
(
int
argc
,
char
**
argv
)
{
AMDiS
::
init
(
argc
,
argv
);
Environment
env
(
argc
,
argv
);
#if HAVE_DUNE_SPGRID
Dune
::
SPCube
<
double
,
2
>
cube
({
0.0
,
0.0
},{
1.0
,
1.0
});
...
...
@@ -92,6 +92,5 @@ int main(int argc, char** argv)
Dune
::
YaspGrid
<
2
>
grid2
({
1.0
,
1.0
},
{
2
,
2
});
run
(
grid2
);
AMDiS
::
finalize
();
return
0
;
}
examples/stokes0.cc
View file @
c3dc225d
...
...
@@ -10,7 +10,7 @@ using StokesProblem = ProblemStat<StokesParam>;
int
main
(
int
argc
,
char
**
argv
)
{
AMDiS
::
init
(
argc
,
argv
);
Environment
env
(
argc
,
argv
);
StokesProblem
prob
(
"stokes"
);
prob
.
initialize
(
INIT_ALL
);
...
...
@@ -58,6 +58,5 @@ int main(int argc, char** argv)
// output solution
prob
.
writeFiles
(
adaptInfo
);
AMDiS
::
finalize
();
return
0
;
}
examples/stokes1.cc
View file @
c3dc225d
...
...
@@ -10,7 +10,7 @@ using StokesProblem = ProblemStat<StokesParam>;
int
main
(
int
argc
,
char
**
argv
)
{
AMDiS
::
init
(
argc
,
argv
);
Environment
env
(
argc
,
argv
);
StokesProblem
prob
(
"stokes"
);
prob
.
initialize
(
INIT_ALL
);
...
...
@@ -58,6 +58,5 @@ int main(int argc, char** argv)
// output solution
prob
.
writeFiles
(
adaptInfo
);
AMDiS
::
finalize
();
return
0
;
}
examples/stokes3.cc
View file @
c3dc225d
...
...
@@ -11,7 +11,7 @@ using StokesProblem = ProblemStat<StokesParam>;
int
main
(
int
argc
,
char
**
argv
)
{
AMDiS
::
init
(
argc
,
argv
);
Environment
env
(
argc
,
argv
);
StokesProblem
prob
(
"stokes"
);
prob
.
initialize
(
INIT_ALL
);
...
...
@@ -48,6 +48,5 @@ int main(int argc, char** argv)
// output solution
prob
.
writeFiles
(
adaptInfo
);
AMDiS
::
finalize
();
return
0
;
}
examples/vecellipt.cc
View file @
c3dc225d
...
...
@@ -15,7 +15,7 @@ using ElliptProblem = ProblemStat<ElliptParam>;
int
main
(
int
argc
,
char
**
argv
)
{
AMDiS
::
init
(
argc
,
argv
);
Environment
env
(
argc
,
argv
);
ElliptProblem
prob
(
"ellipt"
);
prob
.
initialize
(
INIT_ALL
);
...
...
@@ -53,6 +53,5 @@ int main(int argc, char** argv)
prob
.
solve
(
adaptInfo
);
prob
.
writeFiles
(
adaptInfo
,
true
);
AMDiS
::
finalize
();
return
0
;
}
src/amdis/AMDiS.cpp
deleted
100644 → 0
View file @
73513f33
#include
"AMDiS.hpp"
// AMDiS includes
#include
<amdis/Initfile.hpp>
#include
<amdis/Output.hpp>
namespace
AMDiS
{
Dune
::
MPIHelper
&
init
(
int
&
argc
,
char
**&
argv
,
std
::
string
const
&
initFileName
)
{
// Maybe initialize MPI
static
Dune
::
MPIHelper
&
mpiHelper
=
Dune
::
MPIHelper
::
instance
(
argc
,
argv
);
Parameters
::
clearData
();
if
(
initFileName
.
empty
()
&&
argc
>
1
)
{
Parameters
::
init
(
argv
[
1
]);
}
else
if
(
!
initFileName
.
empty
())
{
Parameters
::
init
(
initFileName
);
}
else
{
warning
(
"No initfile specified. Using default values for all parameters."
);
}
return
mpiHelper
;
}
void
finalize
()
{}
}
// end namespace AMDiS
src/amdis/AMDiS.hpp
View file @
c3dc225d
...
...
@@ -4,16 +4,11 @@
# include "config.h"
#endif
// std c++ headers
#include
<string>
#include
<dune/common/exceptions.hh>
// We use exceptions
#include
<dune/common/parallel/mpihelper.hh>
namespace
AMDiS
{
Dune
::
MPIHelper
&
init
(
int
&
argc
,
char
**&
argv
,
std
::
string
const
&
initFileName
=
""
);
void
finalize
();
}
// end namespace AMDiS
#include
<amdis/AdaptInfo.hpp>
#include
<amdis/Environment.hpp>
#include
<amdis/Initfile.hpp>
#include
<amdis/LinearAlgebra.hpp>
#include
<amdis/Output.hpp>
#include
<amdis/ProblemStat.hpp>
namespace
AMDiS
{}
// end namespace AMDiS
src/amdis/AdaptInfo.cpp
View file @
c3dc225d
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include
"AdaptInfo.hpp"
// std c++ headers
...
...
src/amdis/AdaptInstationary.cpp
View file @
c3dc225d
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include
"AdaptInstationary.hpp"
// AMDiS includes
...
...
src/amdis/AdaptStationary.cpp
View file @
c3dc225d
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include
"AdaptStationary.hpp"
// AMDiS includes
...
...
src/amdis/CMakeLists.txt
View file @
c3dc225d
...
...
@@ -4,7 +4,7 @@ dune_library_add_sources(amdis SOURCES
AdaptInfo.cpp
AdaptInstationary.cpp
AdaptStationary.cpp
AMDiS
.cpp
Environment
.cpp
Initfile.cpp
InitfileParser.cpp
ProblemInstatBase.cpp
...
...
@@ -31,6 +31,7 @@ install(FILES
DataTransfer.inc.hpp
DirichletBC.hpp
DirichletBC.inc.hpp
Environment.hpp
FileWriter.hpp
FileWriterInterface.hpp
Flag.hpp
...
...
src/amdis/DataTransfer.inc.hpp
View file @
c3dc225d
...
...
@@ -14,6 +14,7 @@
#include
<dune/common/fvector.hh>
#include
<dune/common/hash.hh>
#include
<dune/grid/common/geometry.hh>
#include
<dune/grid/common/mcmgmapper.hh>
#include
<dune/grid/common/rangegenerators.hh>
...
...
src/amdis/Environment.cpp
0 → 100644
View file @
c3dc225d
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include
"Environment.hpp"
// AMDiS includes
#include
<amdis/Initfile.hpp>
#include
<amdis/Output.hpp>
namespace
AMDiS
{
Environment
::
Environment
(
std
::
string
const
&
initFileName
)
{
Parameters
::
clearData
();
if
(
!
initFileName
.
empty
())
Parameters
::
init
(
initFileName
);
}
Environment
::
Environment
(
int
&
argc
,
char
**&
argv
,
std
::
string
const
&
initFileName
)
:
Environment
(
initFileName
)
{
auto
&
helper
=
Dune
::
MPIHelper
::
instance
(
argc
,
argv
);
auto
&
mpi
=
Mpi
::
instance
();
mpi
.
registerMpiHelper
(
helper
);
Parameters
::
clearData
();
if
(
initFileName
.
empty
())
{
if
(
argc
>
1
)
Parameters
::
init
(
argv
[
1
]);
else
warning
(
"No initfile specified. Using default values for all parameters."
);
}
}
}
// end namespace AMDiS
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment