Commit 27d9db63 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#745 Utilities: add __FILE__ and __LINE__ to the call of functions used to...

#745 Utilities: add __FILE__ and __LINE__ to the call of functions used to create/remove files or folders.
parent 8d589b83
......@@ -622,7 +622,7 @@ Petsc1 = {
-- List of solver: { chebychev cg gmres preonly bicg python };
-- Expected format: {"VALUE1", "VALUE2", ...}
-- Constraint: ops_in(v, {'Mumps', 'Umfpack'})
solver = 'Umfpack',
solver = 'Mumps',
} -- Petsc
......
......@@ -42,7 +42,7 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
......
......@@ -42,7 +42,7 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
......
......@@ -73,6 +73,10 @@
argument = "$(BUILT_PRODUCTS_DIR)/Test"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "--input_parameters ${HOME}/Codes/HappyHeart/Data/Lua/demo_input_hyperelasticity.lua"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable
......
......@@ -33,7 +33,7 @@ namespace HappyHeart
std::ofstream out;
File::Create(out, time_log_filename);
File::Create(out, time_log_filename, __FILE__, __LINE__);
TimeKeep::CreateOrGetInstance(std::move(out));
}
......
......@@ -142,7 +142,7 @@ namespace HappyHeart
*
* Should be called only by GodOfDof.
*/
void ShrinkToProcessorWise(const GodOfDof& god_of_dof); // \todo #605 Make it private!
void ShrinkToProcessorWise(const GodOfDof& god_of_dof);
/*!
......
......@@ -628,9 +628,7 @@ namespace HappyHeart
// Inform the other processors of whether there is a boundary condition or not, and take note
// of theirs sending of the same information.
auto are_dof_on_bc_on_current_proc = relevant_dof_list.empty() ? 0u : 1u;
if (mpi.AllReduce(are_dof_on_bc_on_current_proc, Wrappers::MpiNS::Op::Sum) > 0u)
if (mpi.AllReduce(relevant_dof_list.empty(), Wrappers::MpiNS::Op::Sum))
boundary_condition.ConsiderNumberingSubset(numbering_subset);
}
......@@ -761,7 +759,7 @@ namespace HappyHeart
if (!File::DoExist(time_iteration_file_))
{
std::ofstream stream;
File::Create(stream, time_iteration_file_);
File::Create(stream, time_iteration_file_, __FILE__, __LINE__);
stream << "# Time iteration; time; filename" << std::endl;
}
}
......@@ -781,7 +779,7 @@ namespace HappyHeart
if (!Folder::DoExist(subfolder)) // \todo #497
Folder::Create(subfolder);
Folder::Create(subfolder, __FILE__, __LINE__);
}
}
......@@ -802,7 +800,7 @@ namespace HappyHeart
std::ostringstream oconv;
oconv << subfolder << "/dof_information_proc_" << mpi.GetRank<int>() << ".hhdata";
std::ofstream out;
File::Create(out, oconv.str());
File::Create(out, oconv.str(), __FILE__, __LINE__);
PrintDofInformation(numbering_subset, out);
}
}
......@@ -826,9 +824,9 @@ namespace HappyHeart
if (mpi.IsRootProcessor())
{
if (Folder::DoExist(output_directory_))
Folder::Remove(output_directory_);
Folder::Remove(output_directory_, __FILE__, __LINE__);
Folder::Create(output_directory_);
Folder::Create(output_directory_, __FILE__, __LINE__);
}
mpi.Barrier();
......@@ -1020,7 +1018,7 @@ namespace HappyHeart
void GodOfDof::ApplyBoundaryCondition(const DirichletBoundaryCondition& dirichlet_bc,
GlobalVector& vector) const
GlobalVector& vector) const
{
const auto& numbering_subset = vector.GetNumberingSubset();
......
......@@ -115,7 +115,7 @@ namespace HappyHeart
std::ostringstream oconv;
oconv << output_directory << "/unknowns.hhdata";
std::ofstream out;
File::Create(out, oconv.str());
File::Create(out, oconv.str(), __FILE__, __LINE__);
const auto& storage = UnknownManager::GetInstance().GetList();
......
......@@ -293,7 +293,7 @@ namespace HappyHeart
if (mpi.IsRootProcessor())
{
std::fstream inout;
File::Append(inout, GetGodOfDof().GetTimeIterationFile());
File::Append(inout, GetGodOfDof().GetTimeIterationFile(), __FILE__, __LINE__);
oconv.str("");
oconv << common_part_for_same_time_iteration << "*.hhdata";
......
......@@ -343,7 +343,7 @@ namespace HappyHeart
oconv << output_directory << "/interfaces_" << mesh.GetUniqueId() << ".hhdata";
std::ofstream out;
File::Create(out, oconv.str());
File::Create(out, oconv.str(), __FILE__, __LINE__);
Private::MeshLevelInterfaceList mesh_interface_list(mesh);
mesh_interface_list.Print(out);
......
......@@ -60,7 +60,7 @@ namespace HappyHeart
target += "/mpi.hhdata";
std::ofstream out;
File::Create(out, target);
File::Create(out, target, __FILE__, __LINE__);
out << "Nprocessor: " << mpi.template Nprocessor<int>() << std::endl;
}
......
......@@ -108,7 +108,7 @@ namespace HappyHeart
const auto& mpi = this->MpiHappyHeart();
if (mpi.IsRootProcessor() && !Folder::DoExist(gate_directory_))
Folder::Create(gate_directory_);
Folder::Create(gate_directory_, __FILE__, __LINE__);
mpi.Barrier();
......
......@@ -28,7 +28,7 @@ namespace HappyHeart
const std::string output_dir = this->GetOutputDirectory() + "/time_it_" + std::to_string(time_manager.NtimeModified()) + "/";
if (mpi.IsRootProcessor())
Folder::Create(output_dir);
Folder::Create(output_dir, __FILE__, __LINE__);
mpi.Barrier();
......@@ -48,7 +48,7 @@ namespace HappyHeart
{
const std::string aitken_output_dir = output_dir + "/aitken_" + std::to_string(aitken_index) + "/";
if (mpi.IsRootProcessor())
Folder::Create(aitken_output_dir);
Folder::Create(aitken_output_dir, __FILE__, __LINE__);
mpi.Barrier();
......
......@@ -43,7 +43,7 @@ int main(int argc, char ** argv)
if (mpi.IsRootProcessor())
{
if (Folder::DoExist(folder))
Folder::Remove(folder);
Folder::Remove(folder, __FILE__, __LINE__);
}
mpi.Barrier();
......
......@@ -237,7 +237,7 @@ namespace HappyHeart
work_var_full_numbering_subset_2,
work_var_interface_numbering_subset,
residual,
dispSdelta,
delta_displacement,
Nvector
};
......
......@@ -125,7 +125,7 @@ namespace HappyHeart
GetNonCstVectorPtr<Solid::work_var_full_numbering_subset_2>() = std::make_unique<GlobalVector>(displacement);
GetNonCstVectorPtr<Solid::H0>() = std::make_unique<GlobalVector>(displacement);
GetNonCstVectorPtr<Solid::residual>() = std::make_unique<GlobalVector>(displacement);
GetNonCstVectorPtr<Solid::dispSdelta>() = std::make_unique<GlobalVector>(displacement);
GetNonCstVectorPtr<Solid::delta_displacement>() = std::make_unique<GlobalVector>(displacement);
......
......@@ -28,7 +28,7 @@ namespace HappyHeart
const std::string output_dir = this->GetOutputDirectory() + "/time_it_" + std::to_string(time_manager.NtimeModified()) + "/";
if (mpi.IsRootProcessor())
Folder::Create(output_dir);
Folder::Create(output_dir, __FILE__, __LINE__);
mpi.Barrier();
......@@ -103,20 +103,20 @@ namespace HappyHeart
// UpdateSolidDisplacementAfterSoF();
auto& dispSdelta = GetNonCstVector<Solid::dispSdelta>();
auto& delta_displacement = GetNonCstVector<Solid::delta_displacement>();
dispSdelta.ZeroEntries(__FILE__, __LINE__);
delta_displacement.ZeroEntries(__FILE__, __LINE__);
dH_solver_->SolveLinear(gmres_shell_matrix, gmres_shell_matrix,
GetVector<Solid::H0>(),
dispSdelta,
delta_displacement,
__FILE__, __LINE__);
{
const PetscReal evaluation_state_min = dispSdelta.Min(__FILE__, __LINE__).second;
const PetscReal evaluation_state_max = dispSdelta.Max(__FILE__, __LINE__).second;
const PetscReal evaluation_state_min = delta_displacement.Min(__FILE__, __LINE__).second;
const PetscReal evaluation_state_max = delta_displacement.Max(__FILE__, __LINE__).second;
std::cout << "\tdispSdelta after Gmres -> " << evaluation_state_min << " and " << evaluation_state_max
<< " on " << dispSdelta.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl; // OK
<< " on " << delta_displacement.GetProgramWiseSize(__FILE__, __LINE__) << " elements." << std::endl; // OK
}
// Update solid displacement and velocity.
......@@ -124,12 +124,12 @@ namespace HappyHeart
auto& displacement = GetNonCstVector<Solid::displacement>();
displacement.Copy(GetVector<Solid::displacement_k0>(), __FILE__, __LINE__);
Wrappers::Petsc::AXPY(-1.,
dispSdelta,
delta_displacement,
displacement,
__FILE__, __LINE__);
}
const double norm = Wrappers::Petsc::NormL2(mpi, dispSdelta, __FILE__, __LINE__);
const double norm = Wrappers::Petsc::NormL2(mpi, delta_displacement, __FILE__, __LINE__);
if (iteration_index == 0u)
absolute_error = norm;
......@@ -184,11 +184,13 @@ namespace HappyHeart
void Model<SolidVariationalFormulationPolicyT>::dH(Vec petsc_input_vector,
Vec& petsc_output_vector)
{
std::cout << this->MpiHappyHeart().GetRankPreffix() << "dH 0"<< std::endl;
// Copy the Petsc object into a wrapped one.
auto& input_displ_vector = GetNonCstVector<Solid::work_var_full_numbering_subset>();
input_displ_vector.SetFromPetscVec(petsc_input_vector, __FILE__, __LINE__);
std::cout << this->MpiHappyHeart().GetRankPreffix() << "dH 10"<< std::endl;
// Update Dirichlet boundary condition.
{
auto& displ_vector_on_interface = GetNonCstVector<Solid::work_var_interface_numbering_subset>();
......@@ -217,29 +219,32 @@ namespace HappyHeart
UpdateFluidDirichletCondition();
}
ImplicitFluidStep(differential::yes);
std::cout << this->MpiHappyHeart().GetRankPreffix() << "dH 30"<< std::endl;
ImplicitFluidStep(differential::yes);
std::cout << this->MpiHappyHeart().GetRankPreffix() << "dH 31"<< std::endl;
auto& fluid_varf = GetNonCstImplicitStepFluidVariationalFormulation();
const auto& differential_fluid_residual = fluid_varf.ComputeResidual(-1.); // to comply with Freefem's script.
std::cout << this->MpiHappyHeart().GetRankPreffix() << "dH 33"<< std::endl;
const auto& solid_varf = SolidVariationalFormulationPolicyT::GetVariationalFormulation();
const auto& solid_numbering_subset = solid_varf.GetNumberingSubset();
auto& solution = GetNonCstVector<Solid::work_var_full_numbering_subset_2>();
std::cout << this->MpiHappyHeart().GetRankPreffix() << "dH 35"<< std::endl;
auto& solid_residual = GetNonCstVector<Solid::residual>();
Wrappers::Petsc::MatMultTranspose(GetInterpolationMatrixSolid2FluidVelocity(),
differential_fluid_residual,
solid_residual,
__FILE__, __LINE__);
std::cout << this->MpiHappyHeart().GetRankPreffix() << "dH 40"<< std::endl;
const auto& solid_tangent = solid_varf.GetSystemMatrix(solid_numbering_subset, solid_numbering_subset);
const auto& god_of_dof = parent::GetGodOfDof(EnumUnderlyingType(MeshIndex::mesh));
auto& dirichlet_bc =
Private::DirichletBoundaryConditionManager::GetInstance().GetNonCstDirichletBoundaryCondition(EnumUnderlyingType(BoundaryConditionIndex::solid));
std::cout << this->MpiHappyHeart().GetRankPreffix() << "dH 50 - NS = "<< solid_residual.GetNumberingSubset().GetUniqueId() << "\t BC = " << dirichlet_bc.GetUniqueId() << std::endl;
god_of_dof.ApplyBoundaryCondition(dirichlet_bc, solid_residual);
......@@ -247,7 +252,7 @@ namespace HappyHeart
solid_residual,
solution,
__FILE__, __LINE__);
std::cout << this->MpiHappyHeart().GetRankPreffix() << "dH 60"<< std::endl;
Wrappers::Petsc::AXPY(-1.,
solution,
input_displ_vector,
......@@ -260,6 +265,8 @@ namespace HappyHeart
if (error_code)
throw Wrappers::Petsc::ExceptionNS::Exception(error_code, "VecCopy",
__FILE__, __LINE__);
std::cout << this->MpiHappyHeart().GetRankPreffix() << "dH 100"<< std::endl;
}
......@@ -428,7 +435,7 @@ namespace HappyHeart
std::cout << "\tImplicit solid step" << std::endl;
{
const auto& foo = GetVector<Solid::dispSdelta>();
const auto& foo = GetVector<Solid::delta_displacement>();
const PetscReal evaluation_state_min = foo.Min(__FILE__, __LINE__).second;
const PetscReal evaluation_state_max = foo.Max(__FILE__, __LINE__).second;
......
......@@ -43,7 +43,7 @@ int main(int argc, char ** argv)
if (mpi.IsRootProcessor())
{
if (Folder::DoExist(folder))
Folder::Remove(folder);
Folder::Remove(folder, __FILE__, __LINE__);
}
mpi.Barrier();
......@@ -81,6 +81,10 @@ int main(int argc, char ** argv)
{
ExceptionNS::PrintAndAbort(mpi, e.What());
}
catch(...)
{
std::cout << "Here?" << std::endl;
}
}
catch(const std::exception& e)
{
......
......@@ -109,7 +109,7 @@ namespace HappyHeart
const auto& mpi = this->MpiHappyHeart();
if (mpi.IsRootProcessor() && !Folder::DoExist(gate_directory_))
Folder::Create(gate_directory_);
Folder::Create(gate_directory_, __FILE__, __LINE__);
mpi.Barrier();
......
......@@ -30,7 +30,7 @@ namespace HappyHeart
out.max_load_factor(Utilities::DefaultMaxLoadFactor());
std::ifstream stream;
File::Read(stream, fiber_file);
File::Read(stream, fiber_file, __FILE__, __LINE__);
std::string line;
......@@ -51,8 +51,6 @@ namespace HappyHeart
std::cout << "Begin FiberList"<< std::endl;
const auto& coords_list = geometric_mesh_region.GetCoordsList();
const auto coords_begin = coords_list.cbegin();
const auto coords_end = coords_list.cend();
......@@ -123,7 +121,6 @@ namespace HappyHeart
+ " whereas fiber values were read for "
+ std::to_string(out.size()) + " vertices.",
__FILE__, __LINE__);
}
......
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