[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Getfem-commits] (no subject)
From: |
Liang Jin Lim |
Subject: |
[Getfem-commits] (no subject) |
Date: |
Tue, 11 Sep 2018 05:34:01 -0400 (EDT) |
branch: im_data_extension
commit cebc94af9cca19b5fd6ecd0dad6671dc3aa0b04e
Author: lj <address@hidden>
Date: Tue Sep 11 11:33:49 2018 +0200
Add additional info (actual tensor size) to the im_data.
---
src/getfem/getfem_im_data.h | 74 +++++++++++++++++++++++++--------------------
src/getfem_im_data.cc | 12 ++++++--
2 files changed, 51 insertions(+), 35 deletions(-)
diff --git a/src/getfem/getfem_im_data.h b/src/getfem/getfem_im_data.h
index 4106e67..3226622 100644
--- a/src/getfem/getfem_im_data.h
+++ b/src/getfem/getfem_im_data.h
@@ -1,33 +1,33 @@
-/* -*- c++ -*- (enables emacs c++ mode) */
-/*===========================================================================
-
- Copyright (C) 2012-2017 Liang Jin Lim
-
- This file is a part of GetFEM++
-
- GetFEM++ is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version along with the GCC Runtime Library
- Exception either version 3.1 or (at your option) any later version.
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License and GCC Runtime Library Exception for more details.
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-
- As a special exception, you may use this file as it is a part of a free
- software library without restriction. Specifically, if other files
- instantiate templates or use macros or inline functions from this file,
- or you compile this file and link it with other files to produce an
- executable, this file does not by itself cause the resulting executable
- to be covered by the GNU Lesser General Public License. This exception
- does not however invalidate any other reasons why the executable file
- might be covered by the GNU Lesser General Public License.
-
-===========================================================================*/
+/* -*- c++ -*- (enables emacs c++ mode) */
+/*===========================================================================
+
+ Copyright (C) 2012-2017 Liang Jin Lim
+
+ This file is a part of GetFEM++
+
+ GetFEM++ is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version along with the GCC Runtime Library
+ Exception either version 3.1 or (at your option) any later version.
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License and GCC Runtime Library Exception for more details.
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ As a special exception, you may use this file as it is a part of a free
+ software library without restriction. Specifically, if other files
+ instantiate templates or use macros or inline functions from this file,
+ or you compile this file and link it with other files to produce an
+ executable, this file does not by itself cause the resulting executable
+ to be covered by the GNU Lesser General Public License. This exception
+ does not however invalidate any other reasons why the executable file
+ might be covered by the GNU Lesser General Public License.
+
+===========================================================================*/
/**
@file getfem_im_data.h
@brief Provides indexing of integration points for mesh_im.
@@ -75,9 +75,12 @@ namespace getfem{
* @param filtered_region index not in the region will be filtered
* out. If filtered_region can contain only convexes or only
* faces or both convexes and faces.
+ * @param Actual_tensor_size the actual size of the tensor the data
represents.
+ Used for example, for a Voigt annotated data.
*/
im_data(const mesh_im& mim_, bgeot::multi_index tensor_size,
- size_type filtered_region_ = size_type(-1));
+ size_type filtered_region_ = size_type(-1),
+ bgeot::multi_index actual_tensor_size = {});
/**
* Constructor. The tensor size by default is a scalar value.
@@ -158,9 +161,13 @@ namespace getfem{
getfem::papprox_integration approx_int_method_of_element(size_type cv)
const
{ return im_.int_method_of_element(cv)->approx_method(); }
- inline const bgeot::multi_index& tensor_size () const { return
tensor_size_;}
+ inline const bgeot::multi_index& tensor_size() const { return
tensor_size_; }
- void set_tensor_size (const bgeot::multi_index& tensor_size);
+ void set_tensor_size(const bgeot::multi_index& tensor_size);
+
+ inline const bgeot::multi_index& actual_tensor_size() const { return
actual_tensor_size_; }
+
+ void set_actual_tensor_size(const bgeot::multi_index &tensor_size);
inline gmm::uint64_type version_number() const { context_check(); return
v_num_; }
@@ -409,6 +416,7 @@ namespace getfem{
mutable gmm::uint64_type v_num_;
bgeot::multi_index tensor_size_;
+ bgeot::multi_index actual_tensor_size_;
size_type nb_tensor_elem_;
lock_factory locks_;
};
diff --git a/src/getfem_im_data.cc b/src/getfem_im_data.cc
index 6a05dae..4efe06b 100644
--- a/src/getfem_im_data.cc
+++ b/src/getfem_im_data.cc
@@ -27,13 +27,15 @@ namespace getfem
im_data::im_data(const getfem::mesh_im& mim,
bgeot::multi_index tsize,
- size_type filtered_region_)
+ size_type filtered_region_,
+ bgeot::multi_index actual_tsize)
: im_(mim), region_(filtered_region_),
nb_int_pts_intern(0), nb_int_pts_onfaces(0),
nb_filtered_int_pts_intern(0), nb_filtered_int_pts_onfaces(0),
locks_()
{
set_tensor_size(tsize);
+ set_actual_tensor_size(actual_tsize);
add_dependency(im_);
update_from_context();
}
@@ -46,6 +48,7 @@ namespace getfem
{
tensor_size_.resize(1);
tensor_size_[0] = 1;
+ actual_tensor_size_ = tensor_size_;
nb_tensor_elem_ = 1;
add_dependency(im_);
update_from_context();
@@ -228,10 +231,15 @@ namespace getfem
}
void im_data::set_tensor_size(const bgeot::multi_index& tsize) {
- tensor_size_ = tsize;
+ if (actual_tensor_size_ == tensor_size_) actual_tensor_size_ = tsize;
+ tensor_size_ = tsize;
nb_tensor_elem_ = tensor_size_.total_size();
}
+ void im_data::set_actual_tensor_size(const bgeot::multi_index& tsize) {
+ actual_tensor_size_ = tsize.empty() ? tensor_size_ : tsize;
+ }
+
bool is_equivalent_with_vector(const bgeot::multi_index &sizes, size_type
vector_size) {
bool checked = false;
size_type size = 1;