95 #include "utility/matrix/nDarray/basics.h" 98 #include <boost/python.hpp> 99 #include "tmpl_operators.h" 121 friend class stiffness_matrix;
131 std::vector<double> pd_nDdata;
138 std::vector<int> dim;
144 inline size_t get_index(
int first,
int second)
const 147 return (first - 1)*dim[1]+second - 1;
149 inline size_t get_index(
int first,
int second,
int third)
const 152 return ((first - 1)*dim[1]+second - 1)*dim[2]+third - 1;
154 inline size_t get_index(
int first,
int second,
int third,
int fourth)
const 157 return (((first - 1)*dim[1]+second - 1)*dim[2]+third - 1)*dim[3]+fourth - 1;
160 void init_dim(
const size_t &,
const int &default_dim= 1);
161 void init_dim(
const std::vector<int> &pdim);
162 inline void clear_dim(
void)
164 inline bool equal_dim(
const std::vector<int> &rval)
const 165 {
return (dim==rval); }
169 void init_data(
const std::vector<double> &);
170 void init_data(
const boost::python::list &);
171 void reset_data_to(
const double &);
172 inline double *get_data_ptr(
void)
173 {
return pd_nDdata.data(); }
174 inline const double *get_data_ptr(
void)
const 175 {
return pd_nDdata.data(); }
176 bool equal_data(
const std::vector<double> &other_data)
const;
177 inline const double &val(
const size_t &where)
const 178 {
return pd_nDdata[where]; }
179 inline double &val(
const size_t &where)
180 {
return pd_nDdata[where]; }
181 inline void clear_data(
void)
182 { pd_nDdata.clear(); }
184 inline void clear(
void)
189 void sum_data(
const std::vector<double> &);
190 void substract_data(
const std::vector<double> &);
192 double sum(
void)
const;
194 inline const double &operator()(
int first)
const 197 return (pd_nDdata[0]);
198 return val(static_cast<size_t>(first - 1));
200 inline double &operator()(
int first)
203 return (pd_nDdata[0]);
204 return val(static_cast<size_t>(first - 1));
206 inline const double &operator()(
int first,
int second)
const 208 const size_t i= get_index(first, second);
211 inline double &operator()(
int first,
int second)
213 const size_t i= get_index(first, second);
216 inline const double &operator()(
int first,
int second,
int third)
const 219 const size_t i= get_index(first, second, third);
222 inline double &operator()(
int first,
int second,
int third)
224 const size_t i= get_index(first, second, third);
227 inline const double &operator()(
int first,
int second,
int third,
int fourth)
const 230 const size_t i= get_index(first, second, third, fourth);
233 inline double &operator()(
int first,
int second,
int third,
int fourth)
235 const size_t i= get_index(first, second, third, fourth);
246 size_t total_number(
void)
const;
247 void total_number(
size_t );
248 void clear_dim(
void);
249 void clear_data(
void);
250 void clear_dim_data(
void);
251 const int &get_dim_pointer(
void)
const;
257 const double *data(
void)
const;
258 void set_dim(
const std::vector<int> &);
259 const std::vector<int> &dim(
void)
const;
262 nDarray(
int rank_of_nDarray=1,
const double &initval=0.0);
263 nDarray(
const std::vector<int> &pdim,
const double *values);
264 nDarray(
const std::vector<int> &pdim,
const std::vector<double> &);
265 nDarray(
const std::vector<int> &pdim,
const boost::python::list &);
266 nDarray(
const boost::python::list &,
const boost::python::list &);
267 nDarray(
const std::vector<int> &pdim,
double initvalue);
270 nDarray(
int rows,
int cols,
double *values);
271 nDarray(
int rows,
int cols,
const std::vector<double> &values);
272 nDarray(
int rows,
int cols,
const boost::python::list &);
273 nDarray(
int rows,
int cols,
double initvalue);
276 explicit nDarray(
const std::string &){};
278 nDarray(
const std::string &flag,
const std::vector<int> &pdim);
279 inline virtual ~
nDarray(
void){};
286 void Initialize_all(
const nDarray &from);
290 void Reset_to(
const double &value);
292 inline const double &operator()(
int first)
const 293 {
return pc_nDarray_rep(first); }
295 inline double &operator()(
int first)
298 return this_no_const->operator()(first);
301 inline const double &operator()(
int first,
int second)
const 302 {
return pc_nDarray_rep(first, second); }
304 inline double &operator()(
int first,
int second)
307 return this_no_const->operator()(first, second);
310 inline const double &operator()(
int first,
int second,
int third)
const 311 {
return pc_nDarray_rep(first, second, third); }
313 inline double &operator()(
int first,
int second,
int third)
316 return this_no_const->operator()(first, second, third);
318 inline const double &operator()(
int first,
int second,
int third,
int fourth)
const 319 {
return pc_nDarray_rep(first, second, third, fourth); }
321 inline double &operator()(
int first,
int second,
int third,
int fourth)
323 return pc_nDarray_rep(first, second, third, fourth);
326 const double &val(
int subscript, ...)
const;
327 double &val(
int subscript, ...);
328 const double &val4(
int first,
int second,
int third,
int fourth)
const;
329 double &val4(
int first,
int second,
int third,
int fourth);
331 const double &cval(
int subscript, ...)
const;
348 nDarray &operator*=(
const double &rval);
349 nDarray operator*(
const double &rval)
const;
353 double sum(
void)
const;
354 double trace(
void)
const;
356 bool operator==(
const nDarray &rval)
const;
364 double Frobenius_norm(
void );
366 double General_norm(
double p );
369 int rank(
void)
const;
370 int dim(
int which)
const;
372 void output(std::ostream &os)
const;
373 void outputshort(std::ostream &os)
const;
374 void print(
const std::string &name =
"t",
const std::string &msg =
"Hi there#", std::ostream &os= std::cout)
const;
375 void printshort(std::ostream &os,
const std::string &msg =
"Hi there#")
const;
376 void mathprint(std::ostream &os)
const;
378 inline std::string toString(
void)
const 383 static void tqli(std::vector<double> &d, std::vector<double> &,
int n, std::vector<std::vector<double> > &z);
384 static void tred2(std::vector<std::vector<double> > &a,
int n, std::vector<double> &d, std::vector<double> &e);
385 static void eigsrt(std::vector<double> &d, std::vector<std::vector<double> > &v,
int n);
392 std::ostream& operator<<(std::ostream &,
const nDarray &);
void init_data(void)
Initialize data vector.
Definition: nDarray.cpp:139
Base class for strain and stress tensors.
Definition: stress_strain_tensor.h:42
Stress tensor.
Definition: stresst.h:70
Boris Jeremic tensor class.
Definition: BJtensor.h:112
FiberSet operator+(const FiberSet &, const FiberSet &)
Return the union of both containers.
Definition: FiberSet.cc:65
Boris Jeremic vector class.
Definition: BJvector.h:102
n-dimensional array.
Definition: nDarray.h:242
Stress tensor of a Cosserat material.
Definition: Cosseratstresst.h:66
Storage of n-dimensional array data.
Definition: nDarray.h:114
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
FiberSet operator-(const FiberSet &, const FiberSet &)
Return the fibers in a that are not in b.
Definition: FiberSet.cc:73
Boris Jeremic matrix class.
Definition: BJmatrix.h:104
std::string to_string(const BJmatrix &)
Returns a string that represents the matrix.
Definition: BJmatrix.cpp:1003
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.cpp:118