Commit 5286f3fd authored by Lukas Riedel's avatar Lukas Riedel

Remove template 'SimplexAdaptive' from all executables

parent 48022ac9
......@@ -45,10 +45,6 @@ template<int dim, int order>
using Simplex = Dune::Dorie::RichardsSimulationTraits<Dune::Dorie::BaseTraits<Dune::UGGrid<dim>,
Dune::GeometryType::BasicType::simplex>,order>;
template<int dim, int order>
using SimplexAdaptive = Dune::Dorie::RichardsSimulationTraits<Dune::Dorie::BaseTraits<Dune::UGGrid<dim>,
Dune::GeometryType::BasicType::simplex>,order>;
template<int dim, int order>
using Cube = Dune::Dorie::RichardsSimulationTraits<Dune::Dorie::BaseTraits<Dune::YaspGrid<dim>,
Dune::GeometryType::BasicType::cube>,order>;
......@@ -89,21 +85,21 @@ int main(int argc, char** argv)
Dune::ParameterTreeParser ptreeparser;
ptreeparser.readINITree(inifilename,inifile);
// Allow for a debugger as gdb or lldb to hook into the process, even if run in parallel
// (by manually setting the variable i to a nonzero value)
bool debugMode = inifile.get<bool>("misc.debugMode");
if (debugMode)
{
int i = 0;
char hostname[256];
gethostname(hostname, sizeof(hostname));
if(helper.rank()==0)
std::cout << "Debug mode activated. Use your debugger to set the variable 'i' to a value > 0 in each process" << std::endl;
printf("PID %d on %s ready for attachment\n", getpid(), hostname);
fflush(stdout);
while (0 == i)
sleep(5);
}
// Allow for a debugger as gdb or lldb to hook into the process, even if run in parallel
// (by manually setting the variable i to a nonzero value)
bool debugMode = inifile.get<bool>("misc.debugMode");
if (debugMode)
{
int i = 0;
char hostname[256];
gethostname(hostname, sizeof(hostname));
if(helper.rank()==0)
std::cout << "Debug mode activated. Use your debugger to set the variable 'i' to a value > 0 in each process" << std::endl;
printf("PID %d on %s ready for attachment\n", getpid(), hostname);
fflush(stdout);
while (0 == i)
sleep(5);
}
// Read necessary variables
const std::string gtype = inifile.get<std::string>("grid.gridType");
......@@ -113,11 +109,17 @@ int main(int argc, char** argv)
const std::string outputPath = inifile.get<std::string>("output.outputPath");
const bool adaptivity = inifile.get<bool>("adaptivity.useAdaptivity");
Dune::Dorie::AdaptivityPolicy adapt_policy =
Dune::Dorie::AdaptivityPolicy::None;
if (adaptivity) {
adapt_policy = Dune::Dorie::AdaptivityPolicy::WaterFlux;
}
// Attempt to create output directory
mkdir(outputPath.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
int result = access(outputPath.c_str(), W_OK);
if (result != 0)
DUNE_THROW(Dune::IOError,"Output folder " << outputPath << " not writable");
int result = access(outputPath.c_str(), W_OK);
if (result != 0)
DUNE_THROW(Dune::IOError,"Output folder " << outputPath << " not writable");
if (helper.rank()==0){
std::cout << "INPUT FILE: " << inifilename << std::endl;
......@@ -133,50 +135,27 @@ int main(int argc, char** argv)
{
if (gtype == "gmsh"){
auto grid = Dune::Dorie::build_grid_gmsh<Dune::UGGrid<2>>(inifile,helper);
if(adaptivity){
switch(FEorder){
case 1:{
Sim<SimplexAdaptive<2,1>> sim(helper,grid,inifile);
sim.set_policy(Dune::Dorie::AdaptivityPolicy::WaterFlux);
sim.run();
break;
}
case 2:{
Sim<SimplexAdaptive<2,2>> sim(helper,grid,inifile);
sim.set_policy(Dune::Dorie::AdaptivityPolicy::WaterFlux);
sim.run();
break;
}
case 3:{
Sim<SimplexAdaptive<2,3>> sim(helper,grid,inifile);
sim.set_policy(Dune::Dorie::AdaptivityPolicy::WaterFlux);
sim.run();
break;
}
default:
DUNE_THROW(Dune::NotImplemented,"Finite Element Order (grid.FEorder) not supported!");
switch(FEorder){
case 1:{
Sim<Simplex<2,1>> sim(helper,grid,inifile);
sim.set_policy(adapt_policy);
sim.run();
break;
}
}
else{ // no adaptivity
switch(FEorder){
case 1:{
Sim<Simplex<2,1>> sim(helper,grid,inifile);
sim.run();
break;
}
case 2:{
Sim<Simplex<2,2>> sim(helper,grid,inifile);
sim.run();
break;
}
case 3:{
Sim<Simplex<2,3>> sim(helper,grid,inifile);
sim.run();
break;
}
default:
DUNE_THROW(Dune::NotImplemented,"Finite Element Order (grid.FEorder) not supported!");
case 2:{
Sim<Simplex<2,2>> sim(helper,grid,inifile);
sim.set_policy(adapt_policy);
sim.run();
break;
}
case 3:{
Sim<Simplex<2,3>> sim(helper,grid,inifile);
sim.set_policy(adapt_policy);
sim.run();
break;
}
default:
DUNE_THROW(Dune::NotImplemented,"Finite Element Order (grid.FEorder) not supported!");
}
}
else if (gtype == "rectangular"){
......@@ -185,19 +164,19 @@ int main(int argc, char** argv)
switch(FEorder){
case 1:{
Sim<CubeAdaptive<2,1>> sim(helper,grid,inifile);
sim.set_policy(Dune::Dorie::AdaptivityPolicy::WaterFlux);
sim.set_policy(adapt_policy);
sim.run();
break;
}
case 2:{
Sim<CubeAdaptive<2,2>> sim(helper,grid,inifile);
sim.set_policy(Dune::Dorie::AdaptivityPolicy::WaterFlux);
sim.set_policy(adapt_policy);
sim.run();
break;
}
case 3:{
Sim<CubeAdaptive<2,3>> sim(helper,grid,inifile);
sim.set_policy(Dune::Dorie::AdaptivityPolicy::WaterFlux);
sim.set_policy(adapt_policy);
sim.run();
break;
}
......@@ -236,50 +215,27 @@ int main(int argc, char** argv)
{
if (gtype == "gmsh"){
auto grid = Dune::Dorie::build_grid_gmsh<Dune::UGGrid<3>>(inifile,helper);
if(adaptivity){
switch(FEorder){
case 1:{
Sim<SimplexAdaptive<3,1>> sim(helper,grid,inifile);
sim.set_policy(Dune::Dorie::AdaptivityPolicy::WaterFlux);
sim.run();
break;
}
case 2:{
Sim<SimplexAdaptive<3,2>> sim(helper,grid,inifile);
sim.set_policy(Dune::Dorie::AdaptivityPolicy::WaterFlux);
sim.run();
break;
}
case 3:{
Sim<SimplexAdaptive<3,3>> sim(helper,grid,inifile);
sim.set_policy(Dune::Dorie::AdaptivityPolicy::WaterFlux);
sim.run();
break;
}
default:
DUNE_THROW(Dune::NotImplemented,"Finite Element Order (grid.FEorder) not supported!");
switch(FEorder){
case 1:{
Sim<Simplex<3,1>> sim(helper,grid,inifile);
sim.set_policy(adapt_policy);
sim.run();
break;
}
}
else{ // no adaptivity
switch(FEorder){
case 1:{
Sim<Simplex<3,1>> sim(helper,grid,inifile);
sim.run();
break;
}
case 2:{
Sim<Simplex<3,2>> sim(helper,grid,inifile);
sim.run();
break;
}
case 3:{
Sim<Simplex<3,3>> sim(helper,grid,inifile);
sim.run();
break;
}
default:
DUNE_THROW(Dune::NotImplemented,"Finite Element Order (grid.FEorder) not supported!");
case 2:{
Sim<Simplex<3,2>> sim(helper,grid,inifile);
sim.set_policy(adapt_policy);
sim.run();
break;
}
case 3:{
Sim<Simplex<3,3>> sim(helper,grid,inifile);
sim.set_policy(adapt_policy);
sim.run();
break;
}
default:
DUNE_THROW(Dune::NotImplemented,"Finite Element Order (grid.FEorder) not supported!");
}
}
else if (gtype == "rectangular"){
......@@ -288,19 +244,19 @@ int main(int argc, char** argv)
switch(FEorder){
case 1:{
Sim<CubeAdaptive<3,1>> sim(helper,grid,inifile);
sim.set_policy(Dune::Dorie::AdaptivityPolicy::WaterFlux);
sim.set_policy(adapt_policy);
sim.run();
break;
}
case 2:{
Sim<CubeAdaptive<3,2>> sim(helper,grid,inifile);
sim.set_policy(Dune::Dorie::AdaptivityPolicy::WaterFlux);
sim.set_policy(adapt_policy);
sim.run();
break;
}
case 3:{
Sim<CubeAdaptive<3,3>> sim(helper,grid,inifile);
sim.set_policy(Dune::Dorie::AdaptivityPolicy::WaterFlux);
sim.set_policy(adapt_policy);
sim.run();
break;
}
......
......@@ -21,10 +21,6 @@ template<int dim, int order>
using Simplex = Dune::Dorie::RichardsSimulationTraits<Dune::Dorie::BaseTraits<Dune::UGGrid<dim>,
Dune::GeometryType::BasicType::simplex>,order>;
template<int dim, int order>
using SimplexAdaptive = Dune::Dorie::RichardsSimulationTraits<Dune::Dorie::BaseTraits<Dune::UGGrid<dim>,
Dune::GeometryType::BasicType::simplex>,order>;
template<int dim, int order>
using Cube = Dune::Dorie::RichardsSimulationTraits<Dune::Dorie::BaseTraits<Dune::YaspGrid<dim>,
Dune::GeometryType::BasicType::cube>,order>;
......@@ -55,35 +51,35 @@ int main (int argc, char** argv)
double result {0.0};
const auto adaptive = inifile.get<bool>("adaptivity.useAdaptivity");
const auto grid_type = inifile.get<std::string>("grid.gridType");
Dune::Dorie::AdaptivityPolicy adapt_policy =
Dune::Dorie::AdaptivityPolicy::None;
if (adaptive) {
if (grid_type == "rectangular") {
adapt_policy = Dune::Dorie::AdaptivityPolicy::WaterFlux;
}
if (grid_type == "rectangular") {
if (adaptive) {
using TestSim = Dune::Dorie::TestSimulation<CubeAdaptive<2, 1>>;
auto grid = Dune::Dorie::build_grid_cube<Dune::UGGrid<2>>(inifile, helper);
TestSim sim(helper, grid, inifile);
sim.set_policy(Dune::Dorie::AdaptivityPolicy::WaterFlux);
sim.set_policy(adapt_policy);
result = sim.run_test();
}
else if (grid_type == "simplex") {
using TestSim = Dune::Dorie::TestSimulation<SimplexAdaptive<2, 1>>;
auto grid = Dune::Dorie::build_grid_gmsh<Dune::UGGrid<2>>(inifile, helper);
TestSim sim(helper, grid, inifile);
sim.set_policy(Dune::Dorie::AdaptivityPolicy::WaterFlux);
result = sim.run_test();
}
}
else {
if (grid_type == "rectangular") {
else {
using TestSim = Dune::Dorie::TestSimulation<Cube<2, 1>>;
auto grid = Dune::Dorie::build_grid_cube<Dune::YaspGrid<2>>(inifile, helper);
TestSim sim(helper, grid, inifile);
result = sim.run_test();
}
else if (grid_type == "simplex") {
using TestSim = Dune::Dorie::TestSimulation<Simplex<2, 1>>;
auto grid = Dune::Dorie::build_grid_gmsh<Dune::UGGrid<2>>(inifile, helper);
TestSim sim(helper, grid, inifile);
result = sim.run_test();
}
}
else if (grid_type == "simplex") {
using TestSim = Dune::Dorie::TestSimulation<Simplex<2, 1>>;
auto grid = Dune::Dorie::build_grid_gmsh<Dune::UGGrid<2>>(inifile, helper);
TestSim sim(helper, grid, inifile);
sim.set_policy(adapt_policy);
result = sim.run_test();
}
if (std::abs(result) > limit) {
......
......@@ -29,10 +29,6 @@ template<int dim, int order>
using Simplex = Dune::Dorie::BaseTraits<Dune::UGGrid<dim>,
Dune::GeometryType::BasicType::simplex>;
template<int dim, int order>
using SimplexAdaptive = Dune::Dorie::BaseTraits<Dune::UGGrid<dim>,
Dune::GeometryType::BasicType::simplex>;
template<int dim, int order>
using Cube = Dune::Dorie::BaseTraits<Dune::YaspGrid<dim>,
Dune::GeometryType::BasicType::cube>;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment