Skip to content

Commit

Permalink
all compiled, to test
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiangyu-Hu committed Jul 29, 2024
1 parent 0fa01a5 commit ded0de8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
12 changes: 6 additions & 6 deletions src/shared/particle_dynamics/general_dynamics/force_prior.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ template <class DynamicsIdentifier>
BaseForcePrior<DynamicsIdentifier>::
BaseForcePrior(DynamicsIdentifier &identifier, const std::string &force_name)
: BaseLocalDynamics<DynamicsIdentifier>(identifier),
force_prior_(base_particles->registerSharedVariable<Vecd>("ForcePrior")),
current_force_(base_particles->registerSharedVariable<Vecd>(force_name)),
previous_force_(base_particles->registerSharedVariable<Vecd>("Previous" + force_name))
force_prior_(this->particles_->template registerSharedVariable<Vecd>("ForcePrior")),
current_force_(this->particles_->template registerSharedVariable<Vecd>(force_name)),
previous_force_(this->particles_->template registerSharedVariable<Vecd>("Previous" + force_name))
{
base_particles->addVariableToRestart<Vecd>("Previous" + force_name);
base_particles->addVariableToSort<Vecd>("Previous" + force_name);
this->particles_->template addVariableToRestart<Vecd>("Previous" + force_name);
this->particles_->template addVariableToSort<Vecd>("Previous" + force_name);
}
//=================================================================================================//
template <class DynamicsIdentifier>
Expand All @@ -27,7 +27,7 @@ void BaseForcePrior<DynamicsIdentifier>::update(size_t index_i, Real dt)
//=================================================================================================//
template <class GravityType>
GravityForce<GravityType>::GravityForce(SPHBody &sph_body, const GravityType &gravity)
: ForcePrior(particles_, "GravityForce"), gravity_(gravity),
: ForcePrior(sph_body, "GravityForce"), gravity_(gravity),
pos_(particles_->getVariableDataByName<Vecd>("Position")),
mass_(particles_->registerSharedVariable<Real>("Mass")),
physical_time_(sph_system_.getSystemVariableDataByName<Real>("PhysicalTime")) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#define CONTACT_REPULSION_H

#include "base_contact_dynamics.h"
#include "force_prior.h"
#include "force_prior.hpp"

namespace SPH
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "all_particle_dynamics.h"
#include "base_material.h"
#include "elastic_dynamics.h"
#include "force_prior.h"
#include "force_prior.hpp"
#include "riemann_solver.h"

namespace SPH
Expand All @@ -43,7 +43,7 @@ namespace solid_dynamics
* @class BaseForceFromFluid
* @brief Base class for computing the forces from the fluid
*/
class BaseForceFromFluid : public ForcePrior, public DataDelegateContact,
class BaseForceFromFluid : public ForcePrior, public DataDelegateContact
{
public:
explicit BaseForceFromFluid(BaseContactRelation &contact_relation, const std::string &force_name);
Expand Down
12 changes: 6 additions & 6 deletions src/shared/particle_dynamics/solid_dynamics/loading_dynamics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void SpringDamperConstraintParticleWise::update(size_t index_i, Real dt)
Vecd delta_x = pos_[index_i] - pos0_[index_i];
loading_force_[index_i] = getSpringForce(index_i, delta_x) * mass_[index_i] +
getDampingForce(index_i) * mass_[index_i];
ForcePrior::update(index_i, dt);
LoadingForce::update(index_i, dt);
}
//=================================================================================================//
SpringNormalOnSurfaceParticles::
Expand Down Expand Up @@ -116,7 +116,7 @@ void SpringNormalOnSurfaceParticles::update(size_t index_i, Real dt)
Vecd delta_x = pos_[index_i] - pos0_[index_i];
loading_force_[index_i] = getSpringForce(index_i, delta_x) +
getDampingForce(index_i);
ForcePrior::update(index_i, dt);
LoadingForce::update(index_i, dt);
}
}
//=================================================================================================//
Expand Down Expand Up @@ -172,7 +172,7 @@ void ExternalForceInBoundingBox::update(size_t index_i, Real dt)
if (bounding_box_.checkContain(pos_[index_i]))
{
loading_force_[index_i] = acceleration_ * mass_[index_i];
ForcePrior::update(index_i, dt);
LoadingForce::update(index_i, dt);
}
}
//=================================================================================================//
Expand All @@ -194,7 +194,7 @@ void ForceInBodyRegion::update(size_t index_i, Real dt)
{
Real time_factor = SMIN(*physical_time_ / end_time_, Real(1.0));
loading_force_[index_i] = force_vector_ * time_factor;
ForcePrior::update(index_i, dt);
BaseLoadingForce<BodyPartByParticle>::update(index_i, dt);
}
//=================================================================================================//
SurfacePressureFromSource::
Expand Down Expand Up @@ -261,7 +261,7 @@ void SurfacePressureFromSource::update(size_t index_i, Real dt)
// vector is made by multiplying it with the surface normal
// add the force to the particle
loading_force_[index_i] = mass_[index_i] * (-1.0) * n_[index_i] * acc_from_pressure;
ForcePrior::update(index_i, dt);
BaseLoadingForce<BodyPartByParticle>::update(index_i, dt);
}
}
//=================================================================================================//
Expand All @@ -274,7 +274,7 @@ PressureForceOnShell::PressureForceOnShell(SPHBody &sph_body, Real pressure)
void PressureForceOnShell::update(size_t index_i, Real dt)
{
loading_force_[index_i] = -pressure_ * Vol_[index_i] * n_[index_i];
ForcePrior::update(index_i, dt);
LoadingForce::update(index_i, dt);
}
//=================================================================================================//
} // namespace solid_dynamics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "base_general_dynamics.h"
#include "base_kernel.h"
#include "elastic_solid.h"
#include "force_prior.h"
#include "force_prior.hpp"
#include "solid_body.h"

namespace SPH
Expand All @@ -47,8 +47,7 @@ class BaseLoadingForce : public BaseForcePrior<DynamicsIdentifier>
{
public:
BaseLoadingForce(DynamicsIdentifier &identifier, const std::string &loading_force_name)
: BaseLocalDynamics<DynamicsIdentifier>(identifier),
BaseForcePrior<DynamicsIdentifier>(identifier, loading_force_name),
: BaseForcePrior<DynamicsIdentifier>(identifier, loading_force_name),
loading_force_(this->particles_->template getVariableDataByName<Vecd>(loading_force_name)){};
virtual ~BaseLoadingForce(){};

Expand Down

0 comments on commit ded0de8

Please sign in to comment.