Commit 3c6a1c3c authored by Dmitry Yu. Naumov's avatar Dmitry Yu. Naumov
Browse files

Merge branch 'SmallFixes' into 'master'

Small code improvements and fixes

See merge request ogs/ogs!3415
parents 47b64255 7a634bb6
......@@ -131,7 +131,7 @@ int main (int argc, char* argv[])
}
INFO("Writing mesh '{:s}' ... ", output_name);
auto result_mesh = mapper.getMesh("SubsurfaceMesh");
auto const result_mesh = mapper.getMesh("SubsurfaceMesh");
if (result_mesh == nullptr)
{
ERR("Mapper returned empty result for 'SubsurfaceMesh'.");
......
......@@ -21,10 +21,6 @@ namespace Lubby2
{
/// Calculates the 18x6 derivative of the residuals with respect to total
/// strain.
///
/// Function definition can not be moved into implementation because of a
/// MSVC compiler errors. See
/// http://stackoverflow.com/questions/1484885/strange-vc-compile-error-c2244
template <int DisplacementDim>
Eigen::Matrix<double, Lubby2<DisplacementDim>::JacobianResidualSize,
Lubby2<DisplacementDim>::KelvinVectorSize>
......
......@@ -22,7 +22,7 @@ namespace MeshLib
/**
* \brief Manipulating and adding prism element layers to an existing 2D mesh
*/
class MeshLayerMapper : public LayeredMeshGenerator
class MeshLayerMapper final : public LayeredMeshGenerator
{
public:
~MeshLayerMapper() override = default;
......
......@@ -113,6 +113,10 @@ createDirichletBoundaryConditionWithinTimeInterval(
auto& param = ParameterLib::findParameter<double>(param_name, parameters, 1,
&bc_mesh);
//! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__DirichletWithinTimeInterval__time_interval}
config.peekConfigParameter<std::string>("time_interval");
auto time_interval = BaseLib::createTimeInterval(config);
// In case of partitioned mesh the boundary could be empty, i.e. there is no
// boundary condition.
#ifdef USE_PETSC
......@@ -127,11 +131,8 @@ createDirichletBoundaryConditionWithinTimeInterval(
}
#endif // USE_PETSC
//! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__DirichletWithinTimeInterval__time_interval}
config.peekConfigParameter<std::string>("time_interval");
return std::make_unique<DirichletBoundaryConditionWithinTimeInterval>(
BaseLib::createTimeInterval(config), param, bc_mesh, dof_table_bulk,
std::move(time_interval), param, bc_mesh, dof_table_bulk,
variable_id, component_id);
}
......
......@@ -79,7 +79,7 @@ struct IntegrationPointData final
std::unique_ptr<typename MaterialLib::Solids::MechanicsBase<
DisplacementDim>::MaterialStateVariables>
material_state_variables;
double integration_weight;
double integration_weight = std::numeric_limits<double>::quiet_NaN();
void pushBackState()
{
......
......@@ -551,13 +551,7 @@ void RichardsMechanicsProcess<DisplacementDim>::postTimestepConcreteProcess(
if (hasMechanicalProcess(process_id))
{
DBUG("PostTimestep RichardsMechanicsProcess.");
std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
auto const n_processes = x.size();
dof_tables.reserve(n_processes);
for (std::size_t process_id = 0; process_id < n_processes; ++process_id)
{
dof_tables.push_back(&getDOFTable(process_id));
}
auto const dof_tables = getDOFTables(x.size());
ProcessLib::ProcessVariable const& pv =
getProcessVariables(process_id)[0];
......@@ -580,13 +574,7 @@ void RichardsMechanicsProcess<DisplacementDim>::
}
DBUG("Compute the secondary variables for RichardsMechanicsProcess.");
std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
auto const n_processes = x.size();
dof_tables.reserve(n_processes);
for (std::size_t process_id = 0; process_id < n_processes; ++process_id)
{
dof_tables.push_back(&getDOFTable(process_id));
}
auto const dof_tables = getDOFTables(x.size());
ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
GlobalExecutor::executeSelectedMemberOnDereferenced(
......@@ -617,6 +605,18 @@ RichardsMechanicsProcess<DisplacementDim>::getDOFTable(
return *_local_to_global_index_map_with_base_nodes;
}
template <int DisplacementDim>
std::vector<NumLib::LocalToGlobalIndexMap const*>
RichardsMechanicsProcess<DisplacementDim>::getDOFTables(
int const number_of_processes) const
{
std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
dof_tables.reserve(number_of_processes);
std::generate_n(std::back_inserter(dof_tables), number_of_processes,
[&]() { return &getDOFTable(dof_tables.size()); });
return dof_tables;
}
template class RichardsMechanicsProcess<2>;
template class RichardsMechanicsProcess<3>;
......
......@@ -96,6 +96,9 @@ private:
NumLib::LocalToGlobalIndexMap const& getDOFTable(
const int process_id) const override;
std::vector<NumLib::LocalToGlobalIndexMap const*> getDOFTables(
const int number_of_processes) const;
private:
std::vector<MeshLib::Node*> _base_nodes;
std::unique_ptr<MeshLib::MeshSubset const> _mesh_subset_base_nodes;
......
Supports Markdown
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