92 #ifndef NDARRAY_REP_HH 93 #define NDARRAY_REP_HH 95 #include "utility/matrix/nDarray/basics.h" 96 #include <boost/python.hpp> 119 friend class stiffness_matrix;
129 std::vector<double> pd_nDdata;
131 std::vector<int> dim;
137 inline int get_nDarray_rank(
void)
const 138 {
return dim.size(); }
142 inline size_t get_index(
int first,
int second)
const 143 {
return (first - 1)*dim[1]+second - 1; }
144 inline size_t get_index(
int first,
int second,
int third)
const 145 {
return ((first - 1)*dim[1]+second - 1)*dim[2]+third - 1; }
146 inline size_t get_index(
int first,
int second,
int third,
int fourth)
const 148 return (((first - 1)*dim[1]+second - 1)*dim[2]+third - 1)*dim[3]+fourth - 1;
152 : pd_nDdata(), total_numb(), dim() {}
153 void init_dim(
const size_t &,
const int &default_dim= 1);
154 void init_dim(
const std::vector<int> &pdim);
155 inline void clear_dim(
void)
157 inline bool equal_dim(
const std::vector<int> &rval)
const 158 {
return (dim==rval); }
162 void init_data(
const std::vector<double> &);
163 void init_data(
const boost::python::list &);
164 void reset_data_to(
const double &);
165 inline const std::vector<double> &get_data(
void)
const 166 {
return pd_nDdata; }
167 inline std::vector<double> &get_data(
void)
168 {
return pd_nDdata; }
169 inline double *get_data_ptr(
void)
170 {
return pd_nDdata.data(); }
171 inline const double *get_data_ptr(
void)
const 172 {
return pd_nDdata.data(); }
173 bool equal_data(
const std::vector<double> &other_data)
const;
174 inline const double &val(
const size_t &where)
const 175 {
return pd_nDdata[where]; }
176 inline double &val(
const size_t &where)
177 {
return pd_nDdata[where]; }
178 inline void clear_data(
void)
179 { pd_nDdata.clear(); }
181 inline void clear(
void)
186 void sum_data(
const std::vector<double> &);
187 void substract_data(
const std::vector<double> &);
189 double sum(
void)
const;
191 inline const double &operator()(
int first)
const 193 if(get_nDarray_rank()==0)
194 return (pd_nDdata[0]);
195 return val(static_cast<size_t>(first - 1));
197 inline double &operator()(
int first)
199 if(get_nDarray_rank()==0)
200 return (pd_nDdata[0]);
201 return val(static_cast<size_t>(first - 1));
203 inline const double &operator()(
int first,
int second)
const 205 const size_t i= get_index(first, second);
208 inline double &operator()(
int first,
int second)
210 const size_t i= get_index(first, second);
213 inline const double &operator()(
int first,
int second,
int third)
const 216 const size_t i= get_index(first, second, third);
219 inline double &operator()(
int first,
int second,
int third)
221 const size_t i= get_index(first, second, third);
224 inline const double &operator()(
int first,
int second,
int third,
int fourth)
const 227 const size_t i= get_index(first, second, third, fourth);
230 inline double &operator()(
int first,
int second,
int third,
int fourth)
232 const size_t i= get_index(first, second, third, fourth);
235 void print(std::ostream &os)
const;
238 std::ostream& operator<<(std::ostream &,
const nDarray_rep &);
void init_data(void)
Initialize data vector.
Definition: nDarray_rep.cc:139
Base class for strain and stress tensors.
Definition: stress_strain_tensor.h:41
Stress tensor.
Definition: stresst.h:70
Boris Jeremic tensor class.
Definition: BJtensor.h:112
Boris Jeremic vector class.
Definition: BJvector.h:102
n-dimensional array.
Definition: nDarray.h:106
Stress tensor of a Cosserat material.
Definition: Cosseratstresst.h:66
Storage of n-dimensional array data.
Definition: nDarray_rep.h:112
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
Boris Jeremic matrix class.
Definition: BJmatrix.h:104
Strain tensor of a Cosserat material.
Definition: Cosseratstraint.h:70
Strain tensor.
Definition: straint.h:68
void init_dim(const size_t &, const int &default_dim=1)
Initialize dimensions vector.
Definition: nDarray_rep.cc:118