8 #ifndef FIELD_ADD_POTENTIAL_IMPL_HH_
9 #define FIELD_ADD_POTENTIAL_IMPL_HH_
14 template <
int spacedim,
class Value>
17 inner_field_(
FieldAlgorithmBase<spacedim, Value>::function_factory(rec, this->value_.n_rows()) )
19 grad_=potential.subvec(0,spacedim-1);
28 template <
int spacedim,
class Value>
31 this->r_value_ = inner_field_->value(p,elm);
33 double potential=arma::dot(grad_ , p) + zero_level_;
34 for(
unsigned int row=0; row < this->value_.n_rows(); row++)
35 for(
unsigned int col=0; col < this->value_.n_cols(); col++)
36 this->value_(row,col) += potential;
38 return this->r_value_;
46 template <
int spacedim,
class Value>
51 inner_field_->value_list(point_list, elm, value_list);
52 for(
unsigned int i=0; i< point_list.size(); i++) {
53 double potential= arma::dot(grad_ , point_list[i]) + zero_level_;
54 Value envelope(value_list[i]);
56 for(
unsigned int row=0; row < this->value_.n_rows(); row++)
57 for(
unsigned int col=0; col < this->value_.n_cols(); col++)
58 envelope(row,col) += potential;
62 template <
int spacedim,
class Value>
65 ASSERT(inner_field_,
"Null data pointer.\n");
66 return inner_field_->set_time(time);
70 template <
int spacedim,
class Value>
bool set_time(const TimeStep &time) override
arma::vec::fixed< spacedim > grad_
Potential gradient.
FieldAddPotential(const arma::vec::fixed< spacedim+1 > &potential_grad, const Input::AbstractRecord &rec, unsigned int n_comp=0)
#define ASSERT_EQUAL(a, b)
double zero_level_
Potential constant term.
virtual ~FieldAddPotential()
virtual void value_list(const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm)
Representation of one time step.
Space< spacedim >::Point Point