Skip to content

Commit 80b8cc4

Browse files
committed
Change apply mesh movement to work with
const reference instead of shared pointer
1 parent cef77db commit 80b8cc4

16 files changed

+47
-55
lines changed

src/elch/4C_elch_moving_boundary_algorithm.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void ElCh::MovingBoundaryAlgorithm::setup()
8181
}
8282

8383
// transfer moving mesh data
84-
scatra_field()->apply_mesh_movement(ale_field()->dispnp());
84+
scatra_field()->apply_mesh_movement(*ale_field()->dispnp());
8585

8686
// initialize the multivector for all possible cases
8787
fluxn_ = scatra_field()->calc_flux_at_boundary(false);
@@ -116,7 +116,7 @@ void ElCh::MovingBoundaryAlgorithm::time_loop()
116116
}
117117

118118
// transfer moving mesh data
119-
scatra_field()->apply_mesh_movement(ale_field()->dispnp());
119+
scatra_field()->apply_mesh_movement(*ale_field()->dispnp());
120120

121121
// time loop
122122
while (not_finished())
@@ -278,7 +278,7 @@ void ElCh::MovingBoundaryAlgorithm::solve_scatra()
278278
}
279279

280280
// transfer moving mesh data
281-
scatra_field()->apply_mesh_movement(ale_field()->dispnp());
281+
scatra_field()->apply_mesh_movement(*ale_field()->dispnp());
282282

283283
// solve coupled electrochemistry equations
284284
scatra_field()->solve();

src/fs3i/4C_fs3i_fps3i_partitioned.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,11 +615,11 @@ void FS3I::PartFPS3I::set_struct_scatra_solution()
615615
void FS3I::PartFPS3I::set_mesh_disp()
616616
{
617617
// fluid field
618-
scatravec_[0]->scatra_field()->apply_mesh_movement(fpsi_->fluid_field()->dispnp());
618+
scatravec_[0]->scatra_field()->apply_mesh_movement(*fpsi_->fluid_field()->dispnp());
619619

620620
// Poro field
621621
scatravec_[1]->scatra_field()->apply_mesh_movement(
622-
fpsi_->poro_field()->structure_field()->dispnp());
622+
*fpsi_->poro_field()->structure_field()->dispnp());
623623
}
624624

625625

src/fs3i/4C_fs3i_partitioned.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,12 +683,12 @@ void FS3I::PartFS3I::set_mesh_disp() const
683683
// fluid field
684684
std::shared_ptr<Adapter::ScaTraBaseAlgorithm> fluidscatra = scatravec_[0];
685685
fluidscatra->scatra_field()->apply_mesh_movement(
686-
fluid_to_fluid_scalar(fsi_->fluid_field()->dispnp()));
686+
*fluid_to_fluid_scalar(fsi_->fluid_field()->dispnp()));
687687

688688
// structure field
689689
std::shared_ptr<Adapter::ScaTraBaseAlgorithm> structscatra = scatravec_[1];
690690
structscatra->scatra_field()->apply_mesh_movement(
691-
structure_to_structure_scalar(fsi_->structure_field()->dispnp()));
691+
*structure_to_structure_scalar(fsi_->structure_field()->dispnp()));
692692
}
693693

694694

src/poroelast_scatra/4C_poroelast_scatra_base.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ void PoroElastScaTra::PoroScatraBase::set_mesh_disp()
203203
dispnp = volcoupl_fluidscatra_->apply_vector_mapping21(*fluid_field()->dispnp());
204204
}
205205

206-
scatra_->scatra_field()->apply_mesh_movement(dispnp);
206+
scatra_->scatra_field()->apply_mesh_movement(*dispnp);
207207

208208
std::shared_ptr<const Core::LinAlg::Vector<double>> sdispnp = nullptr;
209209

src/porofluid_pressure_based_elast_scatra/4C_porofluid_pressure_based_elast_scatra_base.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ void PoroPressureBased::PoroMultiPhaseScaTraBase::set_poro_solution()
292292
if (poroscatra == nullptr) FOUR_C_THROW("cast to ScaTraTimIntPoroMulti failed!");
293293

294294
// set displacements
295-
poroscatra->apply_mesh_movement(poromulti_->struct_dispnp());
295+
poroscatra->apply_mesh_movement(*poromulti_->struct_dispnp());
296296

297297
// set the fluid solution
298298
poroscatra->set_solution_field_of_multi_fluid(

src/scatra/4C_scatra_timint_implicit.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,8 +1644,7 @@ void ScaTra::ScaTraTimIntImpl::update()
16441644

16451645
/*----------------------------------------------------------------------*
16461646
*----------------------------------------------------------------------*/
1647-
void ScaTra::ScaTraTimIntImpl::apply_mesh_movement(
1648-
std::shared_ptr<const Core::LinAlg::Vector<double>> dispnp)
1647+
void ScaTra::ScaTraTimIntImpl::apply_mesh_movement(const Core::LinAlg::Vector<double>& dispnp) const
16491648
{
16501649
//---------------------------------------------------------------------------
16511650
// only required in ALE case
@@ -1654,12 +1653,9 @@ void ScaTra::ScaTraTimIntImpl::apply_mesh_movement(
16541653
{
16551654
TEUCHOS_FUNC_TIME_MONITOR("SCATRA: apply mesh movement");
16561655

1657-
// check existence of displacement vector
1658-
if (dispnp == nullptr) FOUR_C_THROW("Got null pointer for displacements!");
1659-
16601656
// provide scatra discretization with displacement field
1661-
discret_->set_state(nds_disp(), "dispnp", *dispnp);
1662-
} // if (isale_)
1657+
discret_->set_state(nds_disp(), "dispnp", dispnp);
1658+
}
16631659
}
16641660

16651661
/*----------------------------------------------------------------------*

src/scatra/4C_scatra_timint_implicit.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ namespace ScaTra
383383
*
384384
* @param[in] dispnp displacement vector
385385
*/
386-
void apply_mesh_movement(std::shared_ptr<const Core::LinAlg::Vector<double>> dispnp);
386+
void apply_mesh_movement(const Core::LinAlg::Vector<double>& dispnp) const;
387387

388388
//! calculate fluxes inside domain and/or on boundary
389389
void calc_flux(const bool writetofile //!< flag for writing flux info to file

src/ssi/4C_ssi_base.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void SSI::SSIBase::setup()
114114
ssicoupling_->setup();
115115

116116
// in case of an ssi multi scale formulation we need to set the displacement here
117-
auto dummy_vec = std::make_shared<Core::LinAlg::Vector<double>>(
117+
auto dummy_vec = Core::LinAlg::Vector<double>(
118118
*Global::Problem::instance()->get_dis("structure")->dof_row_map(), true);
119119
ssicoupling_->set_mesh_disp(scatra_base_algorithm(), dummy_vec);
120120

@@ -519,7 +519,7 @@ void SSI::SSIBase::test_results(MPI_Comm comm) const
519519

520520
/*----------------------------------------------------------------------*/
521521
/*----------------------------------------------------------------------*/
522-
void SSI::SSIBase::set_struct_solution(std::shared_ptr<const Core::LinAlg::Vector<double>> disp,
522+
void SSI::SSIBase::set_struct_solution(const Core::LinAlg::Vector<double>& disp,
523523
std::shared_ptr<const Core::LinAlg::Vector<double>> vel, const bool set_mechanical_stress)
524524
{
525525
// safety checks
@@ -614,7 +614,7 @@ void SSI::SSIBase::set_mechanical_stress_state(
614614

615615
/*----------------------------------------------------------------------*/
616616
/*----------------------------------------------------------------------*/
617-
void SSI::SSIBase::set_mesh_disp(std::shared_ptr<const Core::LinAlg::Vector<double>> disp)
617+
void SSI::SSIBase::set_mesh_disp(const Core::LinAlg::Vector<double>& disp)
618618
{
619619
// safety checks
620620
check_is_init();

src/ssi/4C_ssi_base.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ namespace SSI
214214
[[nodiscard]] std::shared_ptr<ScaTra::ScaTraTimIntImpl> scatra_manifold() const;
215215

216216
/// set structure solution on other fields
217-
void set_struct_solution(std::shared_ptr<const Core::LinAlg::Vector<double>> disp,
217+
void set_struct_solution(const Core::LinAlg::Vector<double>& disp,
218218
std::shared_ptr<const Core::LinAlg::Vector<double>> vel, bool set_mechanical_stress);
219219

220220
/// set scatra solution on other fields
@@ -377,7 +377,7 @@ namespace SSI
377377
[[nodiscard]] bool is_init() const { return isinit_; }
378378

379379
/// set structure mesh displacement on scatra field
380-
void set_mesh_disp(std::shared_ptr<const Core::LinAlg::Vector<double>> disp);
380+
void set_mesh_disp(const Core::LinAlg::Vector<double>& disp);
381381

382382
/// set structure velocity field on scatra field
383383
void set_velocity_fields(std::shared_ptr<const Core::LinAlg::Vector<double>> vel);

src/ssi/4C_ssi_coupling.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ void SSI::SSICouplingMatchingVolume::set_mechanical_stress_state(
129129
/*----------------------------------------------------------------------*/
130130
/*----------------------------------------------------------------------*/
131131
void SSI::SSICouplingMatchingVolume::set_mesh_disp(
132-
std::shared_ptr<Adapter::ScaTraBaseAlgorithm> scatra,
133-
std::shared_ptr<const Core::LinAlg::Vector<double>> disp)
132+
std::shared_ptr<Adapter::ScaTraBaseAlgorithm> scatra, const Core::LinAlg::Vector<double>& disp)
134133
{
135134
scatra->scatra_field()->apply_mesh_movement(disp);
136135
}
@@ -278,11 +277,10 @@ void SSI::SSICouplingNonMatchingBoundary::assign_material_pointers(
278277
/*----------------------------------------------------------------------*/
279278
/*----------------------------------------------------------------------*/
280279
void SSI::SSICouplingNonMatchingBoundary::set_mesh_disp(
281-
std::shared_ptr<Adapter::ScaTraBaseAlgorithm> scatra,
282-
std::shared_ptr<const Core::LinAlg::Vector<double>> disp)
280+
std::shared_ptr<Adapter::ScaTraBaseAlgorithm> scatra, const Core::LinAlg::Vector<double>& disp)
283281
{
284282
scatra->scatra_field()->apply_mesh_movement(
285-
adaptermeshtying_->master_to_slave(*extractor_->extract_cond_vector(*disp)));
283+
*adaptermeshtying_->master_to_slave(*extractor_->extract_cond_vector(disp)));
286284
}
287285

288286
/*----------------------------------------------------------------------*/
@@ -402,11 +400,10 @@ void SSI::SSICouplingNonMatchingVolume::assign_material_pointers(
402400
/*----------------------------------------------------------------------*/
403401
/*----------------------------------------------------------------------*/
404402
void SSI::SSICouplingNonMatchingVolume::set_mesh_disp(
405-
std::shared_ptr<Adapter::ScaTraBaseAlgorithm> scatra,
406-
std::shared_ptr<const Core::LinAlg::Vector<double>> disp)
403+
std::shared_ptr<Adapter::ScaTraBaseAlgorithm> scatra, const Core::LinAlg::Vector<double>& disp)
407404
{
408405
scatra->scatra_field()->apply_mesh_movement(
409-
volcoupl_structurescatra_->apply_vector_mapping21(*disp));
406+
*volcoupl_structurescatra_->apply_vector_mapping21(disp));
410407
}
411408

412409
/*----------------------------------------------------------------------*/
@@ -604,8 +601,7 @@ void SSI::SSICouplingMatchingVolumeAndBoundary::assign_material_pointers(
604601
/*----------------------------------------------------------------------*/
605602
/*----------------------------------------------------------------------*/
606603
void SSI::SSICouplingMatchingVolumeAndBoundary::set_mesh_disp(
607-
std::shared_ptr<Adapter::ScaTraBaseAlgorithm> scatra,
608-
std::shared_ptr<const Core::LinAlg::Vector<double>> disp)
604+
std::shared_ptr<Adapter::ScaTraBaseAlgorithm> scatra, const Core::LinAlg::Vector<double>& disp)
609605
{
610606
scatra->scatra_field()->apply_mesh_movement(disp);
611607
}

0 commit comments

Comments
 (0)