21 #include "libmesh/parameter_vector.h" 23 #include "libmesh/int_range.h" 24 #include "libmesh/parameter_pointer.h" 31 : _is_shallow_copy(
false)
34 _params.reserve(params.size());
44 const std::size_t Np = this->
_params.size();
51 for (std::size_t i=0; i != Np; ++i)
54 std::make_unique<ParameterPointer<Number>>
64 target._my_data.clear();
65 target._params.resize(this->
_params.size());
67 target._params[i] = this->_params[i]->clone();
69 target._is_shallow_copy =
true;
77 const std::size_t Np = this->
_params.size();
78 libmesh_assert_equal_to (target._params.size(), Np);
80 for (std::size_t i=0; i != Np; ++i)
81 *target[i] = *(*
this)[i];
105 for (std::size_t i=0; i != s; ++i)
114 const std::size_t Np = this->
_params.size();
115 for (std::size_t i=0; i != Np; ++i)
124 const std::size_t Np = this->
_params.size();
125 libmesh_assert_equal_to (a.
_params.size(), Np);
126 for (std::size_t i=0; i != Np; ++i)
127 *(*
this)[i] += *a[i];
void resize(std::size_t s)
Sets the number of parameters to be used.
void deep_copy(ParameterVector &target) const
Deep copy constructor: the target will now own new copies of all the parameter values I'm pointing to...
void deep_resize(std::size_t s)
Sets the number of parameters to be used.
Data structure for specifying which Parameters should be independent variables in a parameter sensiti...
Accessor object allowing reading and modification of the independent variables in a parameter sensiti...
The libMesh namespace provides an interface to certain functionality in the library.
ParameterVector & operator*=(const Number a)
Multiplication operator; acts individually on each parameter.
bool _is_shallow_copy
Am I a shallow copy? If so then resizing me would be a bug.
void clear()
Resets to "no parameters".
ParameterVector()=default
Default constructor: "no parameters".
std::vector< std::unique_ptr< ParameterAccessor< Number > > > _params
Pointers to parameters which may exist elsewhere.
std::vector< Number > _my_data
Parameters which I own; e.g.
ParameterVector & operator+=(const ParameterVector &a)
Addition operator.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
void value_copy(ParameterVector &target) const
Value copy method: the target, which should already have as many parameters as I do, will now have those parameters set to my values.
void shallow_copy(ParameterVector &target) const
Shallow copy constructor: the target will now point to all the parameter values I'm pointing to...