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_;