From 0bb9fde993c7631f235b690bdde1890346560045 Mon Sep 17 00:00:00 2001 From: Xiangyu Hu Date: Sat, 22 Jun 2024 10:53:21 +0000 Subject: [PATCH] clean observation method --- .../general_dynamics/general_interpolation.h | 19 +------------------ src/shared/particles/base_particles.h | 1 - 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/src/shared/particle_dynamics/general_dynamics/general_interpolation.h b/src/shared/particle_dynamics/general_dynamics/general_interpolation.h index 2b54d65243..d772752448 100644 --- a/src/shared/particle_dynamics/general_dynamics/general_interpolation.h +++ b/src/shared/particle_dynamics/general_dynamics/general_interpolation.h @@ -112,26 +112,9 @@ class ObservingAQuantity : public InteractionDynamics>(contact_relation, variable_name) { - this->interpolated_quantities_ = registerObservedQuantity(variable_name); + this->interpolated_quantities_ = this->particles_->template registerSharedVariable(variable_name); }; virtual ~ObservingAQuantity(){}; - - protected: - StdLargeVec *observed_quantities_; - - /** Register the observed variable if the variable name is new. - * If the variable is registered already, the registered variable will be returned. */ - StdLargeVec *registerObservedQuantity(const std::string &variable_name) - { - BaseParticles *particles = this->particles_; - DiscreteVariable *variable = findVariableByName(particles->AllDiscreteVariables(), variable_name); - if (variable == nullptr) - { - observed_quantities_ = particles->registerSharedVariable(variable_name, ZeroData::value); - return observed_quantities_; - } - return particles->getVariableByName(variable_name); - }; }; /** diff --git a/src/shared/particles/base_particles.h b/src/shared/particles/base_particles.h index 9f5fd10739..641743ea5c 100644 --- a/src/shared/particles/base_particles.h +++ b/src/shared/particles/base_particles.h @@ -124,7 +124,6 @@ class BaseParticles StdLargeVec *registerSharedVariableFrom(const std::string &new_name, const std::string &old_name); template StdLargeVec *getVariableByName(const std::string &variable_name); - ParticleVariables &AllDiscreteVariables() { return all_discrete_variables_; }; template DataType *registerSingleVariable(const std::string &variable_name,