diff --git a/problems/film-on-substrate.parset b/problems/film-on-substrate.parset index 61e3fde5626f44f40bbf3d0198a212b7559a7f9f..55b999fca1bb4703c13bd3126015711877869661 100644 --- a/problems/film-on-substrate.parset +++ b/problems/film-on-substrate.parset @@ -1,3 +1,10 @@ +############################################# +# Output parameters +############################################# +deformationOutput = deformation +rotationOutput = rotation +pathToOutput = ./ + ############################################# # Grid parameters ############################################# diff --git a/src/film-on-substrate.cc b/src/film-on-substrate.cc index b3458874d8e2e9fd8920406586c5be094f37ea74..5f5134fe7d641f802b120830cb58d9892fd5f731 100644 --- a/src/film-on-substrate.cc +++ b/src/film-on-substrate.cc @@ -649,7 +649,14 @@ int main (int argc, char *argv[]) try } std::string ending = grid->leafGridView().comm().size() > 1 ? std::to_string(mpiHelper.rank()) : ""; std::ofstream file; - file.open("deformation" + ending); + std::string pathToOutput = parameterSet.hasKey("pathToOutput") ? parameterSet.get<std::string>("pathToOutput") : "./"; + std::string deformationOutput = parameterSet.hasKey("deformationOutput") ? parameterSet.get<std::string>("deformationOutput") : "deformation"; + std::string rotationOutput = parameterSet.hasKey("rotationOutput") ? parameterSet.get<std::string>("rotationOutput") : "rotation"; + + deformationOutput = pathToOutput + deformationOutput; + rotationOutput = pathToOutput + rotationOutput; + + file.open(deformationOutput + ending); for (int i = 0; i < identity.size(); i++){ file << identity[i] << ":" << displacement[i] << "\n"; } @@ -659,7 +666,7 @@ int main (int argc, char *argv[]) try BlockVector<FieldVector<double,dim> > identityRotation(orientationFEBasis.size()); Dune::Functions::interpolate(orientationPowerBasis, identityRotation, [](FieldVector<double,dim> x){ return x; }); - file.open("rotation" + ending); + file.open(rotationOutput + ending); for (int i = 0; i < identityRotation.size(); i++){ file << identityRotation[i] << ":" << x[_1][i] << "\n"; } @@ -669,25 +676,25 @@ int main (int argc, char *argv[]) try MPI_Barrier(grid->leafGridView().comm()); if (grid->leafGridView().comm().size() > 1 && mpiHelper.rank() == 0) { - file.open("deformation"); + file.open(deformationOutput); for (int i = 0; i < grid->leafGridView().comm().size(); i++) { - std::ifstream deformationInput("deformation" + std::to_string(i)); + std::ifstream deformationInput(deformationOutput + std::to_string(i)); if (deformationInput.is_open()) { file << deformationInput.rdbuf(); } deformationInput.close(); - std::remove(("deformation" + std::to_string(i)).c_str()); + std::remove((deformationOutput + std::to_string(i)).c_str()); } file.close(); - file.open("rotation"); + file.open(rotationOutput); for (int i = 0; i < grid->leafGridView().comm().size(); i++) { - std::ifstream rotationInput("rotation" + std::to_string(i)); + std::ifstream rotationInput(rotationOutput + std::to_string(i)); if (rotationInput.is_open()) { file << rotationInput.rdbuf(); } rotationInput.close(); - std::remove(("rotation" + std::to_string(i)).c_str()); + std::remove((rotationOutput + std::to_string(i)).c_str()); } file.close(); }