40 #ifndef GETFEM_IM_DATA_H__ 
   41 #define GETFEM_IM_DATA_H__ 
   47   using bgeot::scalar_type;
 
   83             bgeot::multi_index actual_tensor_size = {});
 
  102                              bool use_filter = 
false) 
const;
 
  109                                    bool use_filter = 
false) 
const;
 
  143     dal::bit_vector 
convex_index(
bool use_filter=
false) 
const;
 
  156     inline operator const mesh_im &() 
const { 
return im_; }
 
  161     getfem::papprox_integration approx_int_method_of_element(
size_type cv)
 const 
  164     inline const bgeot::multi_index& tensor_size()
 const { 
return tensor_size_; }
 
  166     void set_tensor_size(
const bgeot::multi_index& tensor_size);
 
  168     inline const bgeot::multi_index& actual_tensor_size()
 const { 
return actual_tensor_size_; }
 
  170     void set_actual_tensor_size(
const bgeot::multi_index &tensor_size);
 
  172     inline gmm::uint64_type version_number()
 const { 
context_check(); 
return v_num_; }
 
  175     template <
typename VECT>
 
  177       if (V1.size() == 0 && V2.size() == 0)
 
  180       GMM_ASSERT2(V1.size() == nb_data*
nb_filtered_index(), 
"Invalid size of vector V1");
 
  181       GMM_ASSERT2(V2.size() == nb_data*
nb_index(), 
"Invalid size of vector V2");
 
  191                            ? convexes[v.cv()].first_int_pt_id
 
  192                            : convexes[v.cv()].first_int_pt_onface_id[v.f()];
 
  194                             ? convexes[v.cv()].first_int_pt_fid
 
  195                             : convexes[v.cv()].first_int_pt_onface_fid[v.f()];
 
  198             gmm::sub_vector(V1, gmm::sub_interval(first_fid*nb_data, nb_pts*nb_data)),
 
  199             gmm::sub_vector(V2, gmm::sub_interval(first_id*nb_data, nb_pts*nb_data)));
 
  204     template <
typename VECT>
 
  206       if (V1.size() == 0 && V2.size() == 0)
 
  209       GMM_ASSERT2(V1.size() == nb_data*
nb_index(), 
"Invalid size of vector V1");
 
  211                                "Invalid size of vector V2");
 
  221                            ? convexes[v.cv()].first_int_pt_id
 
  222                            : convexes[v.cv()].first_int_pt_onface_id[v.f()];
 
  224                             ? convexes[v.cv()].first_int_pt_fid
 
  225                             : convexes[v.cv()].first_int_pt_onface_fid[v.f()];
 
  228             gmm::sub_vector(V1, gmm::sub_interval(first_id*nb_data, nb_pts*nb_data)),
 
  229             gmm::sub_vector(V2, gmm::sub_interval(first_fid*nb_data, nb_pts*nb_data)));
 
  235     template <
typename VECT>
 
  237                                         size_type i, 
bool use_filter = 
true)
 const {
 
  238       GMM_ASSERT2(nb_tensor_elem_*
nb_index(use_filter) == V1.size(),
 
  239                   "Invalid tensorial size for vector V1");
 
  240       GMM_ASSERT2(nb_tensor_elem_ == 1, 
"im_data is not of scalar type");
 
  242       GMM_ASSERT2(ptid != 
size_type(-1), 
"Point index of gauss point not found");
 
  248     template <
typename VECT1, 
typename VECT2>
 
  250                     VECT2& V2, 
bool use_filter = 
true)
 const {
 
  251       if (V1.size() == 0 && V2.size() == 0)
 
  253       GMM_ASSERT2(nb_tensor_elem_*
nb_index(use_filter) == V1.size(),
 
  254                   "Invalid tensorial size for vector V1");
 
  256                   "V2 is incompatible with im_data tensor size");
 
  258       GMM_ASSERT2(ptid != 
size_type(-1), 
"Point index of gauss point not found");
 
  259       gmm::copy(gmm::sub_vector(V1, gmm::sub_interval(ptid*nb_tensor_elem_,
 
  266     template <
typename VECT, 
typename MAT>
 
  268                     MAT& M, 
bool use_filter = 
true)
 const {
 
  269       if (V1.size() == 0 && M.size() == 0)
 
  271       GMM_ASSERT2(nb_tensor_elem_*
nb_index(use_filter) == V1.size(),
 
  272                   "Invalid tensorial size for vector V1");
 
  274                   "M is incompatible with im_data tensor size");
 
  276       GMM_ASSERT2(ptid != 
size_type(-1), 
"Point index of gauss point not found");
 
  277       gmm::copy(gmm::sub_vector(V1, gmm::sub_interval(ptid*nb_tensor_elem_,
 
  284     template <
typename VECT, 
typename TENSOR>
 
  286                     TENSOR& T, 
bool use_filter = 
true)
 const {
 
  287       if (V1.size() == 0 && T.size() == 0)
 
  289       GMM_ASSERT2(nb_tensor_elem_*
nb_index(use_filter) == V1.size(),
 
  290                   "Invalid tensorial size for vector V1");
 
  291       GMM_ASSERT2(tensor_size_ == T.sizes(),
 
  292                   "T is incompatible with im_data tensor size");
 
  294       GMM_ASSERT2(ptid != 
size_type(-1), 
"Point index of gauss point not found");
 
  295       gmm::copy(gmm::sub_vector(V1, gmm::sub_interval(ptid*nb_tensor_elem_,
 
  302     template <
typename VECT>
 
  304                                          bool use_filter = 
true)
 const {
 
  305       GMM_ASSERT2(nb_tensor_elem_*
nb_index(use_filter) == V1.size(),
 
  306                   "Invalid tensorial size for vector V1");
 
  307       GMM_ASSERT2(nb_tensor_elem_ == 1, 
"im_data is not of scalar type");
 
  309       GMM_ASSERT2(ptid != 
size_type(-1), 
"Point index of gauss point not found");
 
  315     template <
typename VECT1, 
typename VECT2>
 
  317                     const VECT2& V2, 
bool use_filter = 
true)
 const {
 
  318       if (V1.size() == 0 && V2.size() == 0)
 
  320       GMM_ASSERT2(nb_tensor_elem_*
nb_index(use_filter) == V1.size(),
 
  321                   "Invalid tensorial size for vector V1");
 
  323                   "V2 is incompatible with im_data tensor size");
 
  325       GMM_ASSERT2(ptid != 
size_type(-1), 
"Point index of gauss point not found");
 
  327                 gmm::sub_vector(V1, gmm::sub_interval(ptid*nb_tensor_elem_,
 
  333     template <
typename VECT, 
typename MAT>
 
  335                     const MAT& M, 
bool use_filter = 
true)
 const {
 
  336       if (V1.size() == 0 && M.size() == 0)
 
  338       GMM_ASSERT2(nb_tensor_elem_*
nb_index(use_filter) == V1.size(),
 
  339                   "Invalid tensorial size for vector V1");
 
  341                   "M is incompatible with im_data tensor size");
 
  343       GMM_ASSERT2(ptid != 
size_type(-1), 
"Point index of gauss point not found");
 
  344       gmm::copy(M.as_vector(),
 
  345                 gmm::sub_vector(V1, gmm::sub_interval(ptid*nb_tensor_elem_,
 
  351     template <
typename VECT, 
typename TENSOR>
 
  353                     const TENSOR& T, 
bool use_filter = 
true)
 const {
 
  354       if (V1.size() == 0 && T.size() == 0)
 
  356       GMM_ASSERT2(nb_tensor_elem_*
nb_index(use_filter) == V1.size(),
 
  357                   "Invalid tensorial size for vector V1");
 
  358       GMM_ASSERT2(tensor_size_ == T.sizes(),
 
  359                   "T is incompatible with im_data tensor size");
 
  361       GMM_ASSERT2(ptid != 
size_type(-1), 
"Point index of gauss point not found");
 
  362       gmm::copy(T.as_vector(),
 
  363                 gmm::sub_vector(V1, gmm::sub_interval(ptid*nb_tensor_elem_,
 
  368     template <
typename VECT1, 
typename VECT2>
 
  370       GMM_ASSERT2(V1.size() != 0, 
"V1 of zero size");
 
  371       GMM_ASSERT2(V2.size() != 0, 
"V2 of zero size");
 
  373                   "V2 is incompatible with im_data tensor size");
 
  375                 gmm::sub_vector(V1, gmm::sub_interval(ptid*nb_tensor_elem_,
 
  379     template <
typename VECT1, 
typename TENSOR>
 
  381       GMM_ASSERT2(V1.size() != 0, 
"V1 of zero size");
 
  382       GMM_ASSERT2(T.size() != 0, 
"V2 of zero size");
 
  383       GMM_ASSERT2(tensor_size_ == T.sizes(),
 
  384                   "T is incompatible with im_data tensor size");
 
  385       gmm::copy(T.as_vector(),
 
  386                 gmm::sub_vector(V1, gmm::sub_interval(ptid*nb_tensor_elem_,
 
  397     mutable size_type      nb_filtered_int_pts_intern;
 
  398     mutable size_type      nb_filtered_int_pts_onfaces;
 
  404       std::vector<size_type> first_int_pt_onface_id;
 
  405       std::vector<size_type> first_int_pt_onface_fid;
 
  406       std::vector<size_type> nb_int_pts_onface;
 
  409         : first_int_pt_id(-1), first_int_pt_fid(-1), nb_int_pts(0),
 
  410           first_int_pt_onface_id(0), first_int_pt_onface_fid(0), nb_int_pts_onface(0)
 
  414     mutable std::vector<convex_data> convexes;
 
  416     mutable gmm::uint64_type v_num_;
 
  418     bgeot::multi_index     tensor_size_;
 
  419     bgeot::multi_index     actual_tensor_size_;
 
base class for static stored objects
Deal with interdependencies of objects.
bool context_check() const
return true if update_from_context was called
im_data provides indexing to the integration points of a mesh im object.
void get_matrix(const VECT &V1, size_type cv, size_type i, MAT &M, bool use_filter=true) const
get a matrix of an integration point from a raw vector data, described by the tensor size.
const mesh & linked_mesh() const
linked mesh
im_data(const mesh_im &mim_, bgeot::multi_index tensor_size, size_type filtered_region_=size_type(-1), bgeot::multi_index actual_tensor_size={})
Constructor.
void set_tensor(VECT &V1, size_type cv, size_type i, const TENSOR &T, bool use_filter=true) const
set a tensor of an integration point from a raw vector data, described by the tensor size.
void get_vector(const VECT1 &V1, size_type cv, size_type i, VECT2 &V2, bool use_filter=true) const
get a vector of an integration point from a raw vector data, described by the tensor size.
void set_matrix(VECT &V1, size_type cv, size_type i, const MAT &M, bool use_filter=true) const
set a matrix of an integration point from a raw vector data, described by the tensor size.
size_type filtered_region() const
return filtered region id
size_type nb_points_of_element(size_type cv, bool use_filter=false) const
Total number of points in element cv.
size_type nb_filtered_points_of_element(size_type cv) const
Total number of points in element cv, which lie in filtered_region()
dal::bit_vector filtered_convex_index() const
List of convex in filtered region.
void update_from_context() const
called automatically when there is a change in dependencies
size_type filtered_index_of_first_point(size_type cv, short_type f=short_type(-1)) const
Returns the index of the first integration point with filtering.
const mesh_im & linked_mesh_im() const
linked mesh im
size_type filtered_index_of_point(size_type cv, size_type i) const
Returns the index of an integration point with filtering.
void set_region(size_type region)
set filtered region id
size_type nb_filtered_points_of_element(size_type cv, short_type f) const
Number of points in element cv, on face f (or in the interior), which lie in filtered_region()
VECT::value_type & set_value(VECT &V1, size_type cv, size_type i, bool use_filter=true) const
set a value of an integration point from a raw vector data, described by the tensor size.
void set_vector(VECT1 &V1, size_type cv, size_type i, const VECT2 &V2, bool use_filter=true) const
set a vector of an integration point from a raw vector data, described by the tensor size.
void get_tensor(const VECT &V1, size_type cv, size_type i, TENSOR &T, bool use_filter=true) const
get a tensor of an integration point from a raw vector data, described by the tensor size.
void reduce_vector(const VECT &V1, VECT &V2) const
Filter a vector from full size to filtered size and copy the data to correct index.
size_type nb_index(bool use_filter=false) const
Total numbers of index (integration points)
short_type nb_faces_of_element(size_type cv) const
Number of (active) faces in element cv.
size_type index_of_first_point(size_type cv, short_type f=short_type(-1), bool use_filter=false) const
Returns the index of the first integration point with no filtering.
void extend_vector(const VECT &V1, VECT &V2) const
Extend a vector from filtered size to full size and copy the data to correct index.
size_type nb_filtered_index() const
Total numbers of filtered index (integration points)
VECT::value_type get_value(const VECT &V1, size_type cv, size_type i, bool use_filter=true) const
get a scalar value of an integration point from a raw vector data, described by the tensor size.
size_type nb_tensor_elem() const
sum of tensor elements, M(3,3) will have 3*3=9 elements
size_type index_of_point(size_type cv, size_type i, bool use_filter=false) const
Returns the index of an integration point with no filtering.
dal::bit_vector convex_index(bool use_filter=false) const
List of convexes.
Describe an integration method linked to a mesh.
virtual pintegration_method int_method_of_element(size_type cv) const
return the integration method associated with an element (in no integration is associated,...
const mesh & linked_mesh() const
Give a reference to the linked mesh of type mesh.
"iterator" class for regions.
structure used to hold a set of convexes and/or convex faces.
Describe a mesh (collection of convexes (elements) and points).
const mesh_region region(size_type id) const
Return the region of index 'id'.
Define the getfem::mesh_im class (integration of getfem::mesh_fem).
gmm::uint16_type short_type
used as the common short type integer in the library
size_t size_type
used as the common size type in the library
GEneric Tool for Finite Element Methods.
bool is_equivalent_with_matrix(const bgeot::multi_index &sizes, size_type nrows, size_type ncols)
check if a given tensor size is equivalent to a matrix
bool is_equivalent_with_vector(const bgeot::multi_index &sizes, size_type vector_size)
check if a given tensor size is equivalent to a vector