Re: [Getfem-commits] please merge branch devel-tetsuo-Add-mixed-methods-with-different-meshes

2019-02-11 Thread Tetsuo Koyama
Dear Yves,

Thank you for your big help. The document which you added became a
good study of getfem for me.
There is no comment about content. I only fixed sphinx source layout.

Could you merge it ?

Best Regards,

Tetsuo

2019年2月12日(火) 0:55 Yves Renard :
>
>
> Dear Tetsuo,
>
> Thank you for your documentation improvement. I make some small adding
> too (on "mixed methods with different meshes" and "mortar methods"). If
> it is ok, I will merge the branch.
>
> Best Regards,
>
> Yves
>
>
> Le 09/02/2019 à 08:03, Tetsuo Koyama a écrit :
> > Dear GetFEM++ project
> >
> > I added model object method description ``add_filtered_fem_variable``
> > (THANKS for Yves Renard). I changed the plan of the description place.
> > I also update the information of "Interpolation of a finite element
> > method on non-matching meshes". (THANKS for Konstantinos Poulios).
> > If there is some mistake or opnion, please comment.
> >
> > Best Regard Tetsuo
> >
>
> --
>
>Yves Renard (yves.ren...@insa-lyon.fr)   tel : (33) 04.72.43.87.08
>INSA-Lyon
>20, rue Albert Einstein
>69621 Villeurbanne Cedex, FRANCE
>http://math.univ-lyon1.fr/~renard
>
> -
>



[Getfem-commits] [getfem-commits] devel-tetsuo-Add-mixed-methods-with-different-meshes updated (710de08 -> 664b86e)

2019-02-11 Thread Tetsuo Koyama
tkoyama010 pushed a change to branch 
devel-tetsuo-Add-mixed-methods-with-different-meshes.

  from  710de08   some documentation improvements
   new  664b86e   Fix layout of sphinx source


Summary of changes:
 doc/sphinx/source/userdoc/interNMM.rst | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)



[Getfem-commits] (no subject)

2019-02-11 Thread Tetsuo Koyama
branch: devel-tetsuo-Add-mixed-methods-with-different-meshes
commit 664b86e4adb3f613464c92e40647f1c55a7fa3d8
Author: Tetsuo Koyama 
Date:   Tue Feb 12 11:37:10 2019 +0900

Fix layout of sphinx source
---
 doc/sphinx/source/userdoc/interNMM.rst | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/doc/sphinx/source/userdoc/interNMM.rst 
b/doc/sphinx/source/userdoc/interNMM.rst
index c8db3c6..d4ad5ee 100644
--- a/doc/sphinx/source/userdoc/interNMM.rst
+++ b/doc/sphinx/source/userdoc/interNMM.rst
@@ -51,9 +51,20 @@ order.
 
 mixed methods with different meshes
 ---
-Instead of using the previous tools (interpolated and projected fems), It is 
possible to use a finite element variable defined on an another mesh than the 
one on which an assembly is computed using the "interpolate transformation" 
tool of the weak form language (see :ref:`ud-gasm-high-transf`), the finite 
element variables will be interpolated on each Gauss point. There is no 
restriction on the dimensions of the mesh used, which means in particular that 
a two-dimensional fem variable can [...]
+Instead of using the previous tools (interpolated and projected fems), it is
+possible to use a finite element variable defined on an another mesh than the 
one
+on which an assembly is computed using the "interpolate transformation" tool of
+the weak form language (see :ref:`ud-gasm-high-transf` ), the finite element
+variables will be interpolated on each Gauss point. There is no restriction
+on the dimensions of the mesh used, which means in particular that a
+two-dimensional fem variable can be interpolated on a one-dimensional mesh
+(allowing the coupling of shell and beam elements, for instance).
+It is also possible to use some transformations like polar coordinates to
+euclidean ones.
 
 
 mortar methods
 --
- Mortar methods are supported by |gf|. The coupling term between non matching 
meshes can in particular be computed using the interpolate transformations of 
the weak form language (see :ref:`ud-gasm-high-transf`).
+Mortar methods are supported by |gf|. The coupling term between non matching
+meshes can in particular be computed using the interpolate transformations of
+the weak form language (see :ref:`ud-gasm-high-transf`).



Re: [Getfem-commits] please merge branch devel-tetsuo-Add-mixed-methods-with-different-meshes

2019-02-11 Thread Yves Renard



Dear Tetsuo,

Thank you for your documentation improvement. I make some small adding 
too (on "mixed methods with different meshes" and "mortar methods"). If 
it is ok, I will merge the branch.


Best Regards,

Yves


Le 09/02/2019 à 08:03, Tetsuo Koyama a écrit :

Dear GetFEM++ project

I added model object method description ``add_filtered_fem_variable``
(THANKS for Yves Renard). I changed the plan of the description place.
I also update the information of "Interpolation of a finite element
method on non-matching meshes". (THANKS for Konstantinos Poulios).
If there is some mistake or opnion, please comment.

Best Regard Tetsuo



--

  Yves Renard (yves.ren...@insa-lyon.fr)   tel : (33) 04.72.43.87.08
  INSA-Lyon
  20, rue Albert Einstein
  69621 Villeurbanne Cedex, FRANCE
  http://math.univ-lyon1.fr/~renard

-




[Getfem-commits] (no subject)

2019-02-11 Thread Yves Renard
branch: devel-tetsuo-Add-mixed-methods-with-different-meshes
commit 710de081b9a2d195983659b5827743ac82bf36cf
Author: Yves Renard 
Date:   Mon Feb 11 16:53:28 2019 +0100

some documentation improvements
---
 doc/sphinx/source/userdoc/interNMM.rst | 10 +-
 doc/sphinx/source/userdoc/model_object.rst | 13 +++--
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/doc/sphinx/source/userdoc/interNMM.rst 
b/doc/sphinx/source/userdoc/interNMM.rst
index f2189b6..c8db3c6 100644
--- a/doc/sphinx/source/userdoc/interNMM.rst
+++ b/doc/sphinx/source/userdoc/interNMM.rst
@@ -6,8 +6,8 @@
 
 .. _ud-internmm:
 
-Interpolation of a finite element method on non-matching meshes
-===
+Interpolation/projection of a finite element method on non-matching meshes
+==
 
 A special finite element method is defined in
 :file:`getfem/getfem_interpolated_fem.h` which is not a real finite element
@@ -26,7 +26,7 @@ such a computation can be a heavy procedure. By default, the 
interpolated fem
 object store the interpolation data.
 
 The interpolation is made on each Gauss point of the integration methods of
-``mim``, so that you have to use these integration methods in the assembling
+``mim``, so only this integration method can be used in assembly
 procedures.
 
 For instance if you need to compute the mass matrix between two different 
finite
@@ -51,9 +51,9 @@ order.
 
 mixed methods with different meshes
 ---
-  to be described ...
+Instead of using the previous tools (interpolated and projected fems), It is 
possible to use a finite element variable defined on an another mesh than the 
one on which an assembly is computed using the "interpolate transformation" 
tool of the weak form language (see :ref:`ud-gasm-high-transf`), the finite 
element variables will be interpolated on each Gauss point. There is no 
restriction on the dimensions of the mesh used, which means in particular that 
a two-dimensional fem variable can [...]
 
 
 mortar methods
 --
-  to be described ...
+ Mortar methods are supported by |gf|. The coupling term between non matching 
meshes can in particular be computed using the interpolate transformations of 
the weak form language (see :ref:`ud-gasm-high-transf`).
diff --git a/doc/sphinx/source/userdoc/model_object.rst 
b/doc/sphinx/source/userdoc/model_object.rst
index a77cadf..2eb2e8e 100644
--- a/doc/sphinx/source/userdoc/model_object.rst
+++ b/doc/sphinx/source/userdoc/model_object.rst
@@ -102,13 +102,14 @@ The main useful methods on a |mo| object are
 
 .. c:function:: add_filtered_fem_variable(name, mf, region)
 
-   Add a variable being the dofs of a finite element method ``mf`` only 
specific region.
+   Add a variable being the dofs of a finite element method ``mf`` only
+   specific to a given region.
(The standard way to define ``mf`` in |gf| is to define in the whole 
domain.)
-   ``name`` is a string which designate the variable. ``region`` is the number 
of region.
-   This function will select the degree of freedom whose shape function is 
non-zero on
-   the given region. It is also possible to select the degrees of freedom by
-   `partial_mesh_fem`. If  |mo| object have different mesh, you can add the 
coupling
-   terms using the interpolation transformations. (See :ref:`ud-interNMM` )
+   ``name`` is a string which designate the variable. ``region`` is the region
+   number. This function will select the degree of freedom whose shape
+   function is non-zero on the given region. Internally, a ``partial_mesh_fem``
+   object will be used. The method ``mesh_fem_of_variable('name')`` allows to
+   access to the ``partial_mesh_fem`` built. 
 
 .. c:function:: add_fem_data(name, mf, niter=1)
 



[Getfem-commits] [getfem-commits] devel-tetsuo-Add-mixed-methods-with-different-meshes updated (8516041 -> 710de08)

2019-02-11 Thread Yves Renard
renard pushed a change to branch 
devel-tetsuo-Add-mixed-methods-with-different-meshes.

  from  8516041   add model object description ``add_filtered_fem_variable``
   new  710de08   some documentation improvements


Summary of changes:
 doc/sphinx/source/userdoc/interNMM.rst | 10 +-
 doc/sphinx/source/userdoc/model_object.rst | 13 +++--
 2 files changed, 12 insertions(+), 11 deletions(-)



[Getfem-commits] [getfem-commits] partitions_initiation updated (467ae55 -> 55089b9)

2019-02-11 Thread Andriy Andreykiv
andrico pushed a change to branch partitions_initiation.

  from  467ae55   1) partitioning can be changed only once; 2) flag in the 
region should be atomic; 3) starting from one thread, if more desired, this 
should be specified
  adds  c2f2204   Add convexes_in_box function to the scripting interface
  adds  b3583f9   remove the projection for invert_lin
  adds  c744abd   Merge remote-tracking branch 
'origin/devel-arsha-remove-projection-in-invert-lin'
  adds  6501f90   Fix ANSYS mesh import when ANSYS skips the last 
coordinate of a node being zero
  adds  d57b018   Fix test error
  adds  72783ed   Fix skipped pfp update due to interpolate filter
  adds  8a4a34b   Minor coding style and whitespace changes
  adds  76a8dc6   Fix printing of interpolate filter nodes in ga_print_node
  adds  69583e8   warning fixes
  adds  94dad7f   Fix warning: this statement may fall through 
[-Wimplicit-fallthrough=]
  adds  86a54a3   minor fixes
   new  5d3e796   Merge branch 'master' of git.sv.gnu.org:/srv/git/getfem 
into partitions_initiation
   new  55089b9   cleaner error messages syntax


Summary of changes:
 interface/src/gf_mesh_get.cc   |  26 +
 src/bgeot_geotrans_inv.cc  |   7 +-
 src/getfem/bgeot_geotrans_inv.h|   3 +-
 src/getfem/getfem_accumulated_distro.h |   7 +-
 .../getfem_generic_assembly_compile_and_exec.h |  16 ++-
 src/getfem/getfem_im_list.h|   2 +-
 src/getfem_contact_and_friction_common.cc  |  66 +---
 src/getfem_generic_assembly_compile_and_exec.cc| 115 ++---
 src/getfem_generic_assembly_semantic.cc|   9 +-
 src/getfem_generic_assembly_tree.cc|  66 ++--
 src/getfem_generic_assembly_workspace.cc   |   2 +-
 src/getfem_import.cc   |   5 +-
 src/getfem_mesh_im_level_set.cc|   1 +
 src/getfem_omp.cc  |  19 ++--
 src/gmm/gmm_opt.h  | 101 +-
 15 files changed, 273 insertions(+), 172 deletions(-)



[Getfem-commits] (no subject)

2019-02-11 Thread Andriy Andreykiv
branch: partitions_initiation
commit 5d3e796f2ddad23d0383bace252079bc8fdae0d9
Merge: 467ae55 86a54a3
Author: Andriy.Andreykiv 
Date:   Mon Feb 11 11:02:17 2019 +0100

Merge branch 'master' of git.sv.gnu.org:/srv/git/getfem into 
partitions_initiation

 interface/src/gf_mesh_get.cc   |  26 +
 src/bgeot_geotrans_inv.cc  |   7 +-
 src/getfem/bgeot_geotrans_inv.h|   3 +-
 src/getfem/getfem_accumulated_distro.h |   7 +-
 .../getfem_generic_assembly_compile_and_exec.h |  16 ++-
 src/getfem/getfem_im_list.h|   2 +-
 src/getfem_contact_and_friction_common.cc  |  66 +---
 src/getfem_generic_assembly_compile_and_exec.cc| 115 ++---
 src/getfem_generic_assembly_semantic.cc|   9 +-
 src/getfem_generic_assembly_tree.cc|  66 ++--
 src/getfem_generic_assembly_workspace.cc   |   2 +-
 src/getfem_import.cc   |   5 +-
 src/getfem_mesh_im_level_set.cc|   1 +
 src/gmm/gmm_opt.h  | 101 +-
 14 files changed, 262 insertions(+), 164 deletions(-)



[Getfem-commits] (no subject)

2019-02-11 Thread Andriy Andreykiv
branch: partitions_initiation
commit 55089b99aecbcfda88da7ed0cb382073a817f806
Author: Andriy.Andreykiv 
Date:   Mon Feb 11 12:14:53 2019 +0100

cleaner error messages syntax
---
 src/getfem_omp.cc | 19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/getfem_omp.cc b/src/getfem_omp.cc
index 2f13e60..a8bb568 100644
--- a/src/getfem_omp.cc
+++ b/src/getfem_omp.cc
@@ -197,7 +197,7 @@ namespace getfem{
 
   void partition_master::set_nb_partitions(size_type n){
 GMM_ASSERT1 (!partitions_set_by_user,
- "Number of partitions can be set only once");
+ "Number of partitions can be set only once.");
 if (n > nb_partitions){
   nb_partitions = n;
   nb_user_threads = true_thread_policy::num_threads();
@@ -207,15 +207,15 @@ namespace getfem{
 else if (n < nb_partitions){
   GMM_WARNING1("Not reducing number of partitions from "
<< nb_partitions <<" to " << n <<
-   " as it might invalidate global storage");
+   " as it might invalidate global storage.");
 }
 partitions_set_by_user = true;
   }
 
   partition_iterator partition_master::begin(){
 GMM_ASSERT1(nb_user_threads == true_thread_policy::num_threads(),
-"The number of omp threads was changed outside 
partition_master"
-"Please use getfem::set_num_threads for this");
+"The number of omp threads was changed outside 
partition_master."
+"Please use getfem::set_num_threads for this.");
 current_partition = *(std::begin(partitions.thrd_cast()));
 return partition_iterator{*this, std::begin(partitions.thrd_cast())};
   }
@@ -227,7 +227,7 @@ namespace getfem{
   void partition_master::set_behaviour(thread_behaviour b){
 if (b != behaviour){
   GMM_ASSERT1(!me_is_multithreaded_now(),
-  "Cannot change thread policy in parallel section");
+  "Cannot change thread policy in parallel section.");
   behaviour = b;
   check_threads();
 }
@@ -245,7 +245,8 @@ namespace getfem{
 true_thread_policy::this_thread() < nb_partitions : true,
 "Requesting current partition for thread " <<
 true_thread_policy::this_thread() <<
-" while number of partitions is " << nb_partitions);
+" while number of partitions is " << nb_partitions
+<< ".");
 return behaviour == thread_behaviour::partition_threads ?
current_partition : true_thread_policy::this_thread();
   }
@@ -259,7 +260,8 @@ namespace getfem{
 if (behaviour == thread_behaviour::partition_threads){
   GMM_ASSERT2(partitions.thrd_cast().count(p) != 0, "Internal error: "
   << p << " is not a valid partitions for thread "
-  << true_thread_policy::this_thread());
+  << true_thread_policy::this_thread()
+  << ".");
   current_partition = p;
 }
   }
@@ -289,7 +291,8 @@ namespace getfem{
 if(n_threads > nb_partitions){
   GMM_WARNING0("Using " << n_threads <<
" threads which is above the maximum number of partitions 
:" <<
-   nb_partitions);
+   nb_partitions
+   << ".");
 }
 if (behaviour == thread_behaviour::partition_threads){
   for (size_type t = 0; t != n_threads; ++t){



[Getfem-commits] (no subject)

2019-02-11 Thread Andriy Andreykiv
branch: partitions_initiation
commit 467ae55d2e5ea1ae9a837ab0c6355964a1716073
Author: Andriy.Andreykiv 
Date:   Mon Feb 11 11:01:41 2019 +0100

1) partitioning can be changed only once; 2) flag in the region should be 
atomic; 3) starting from one thread, if more desired, this should be specified
---
 src/getfem_mesh_region.cc |  6 +++---
 src/getfem_omp.cc | 13 -
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/getfem_mesh_region.cc b/src/getfem_mesh_region.cc
index 7a5e6fa..4986739 100644
--- a/src/getfem_mesh_region.cc
+++ b/src/getfem_mesh_region.cc
@@ -91,7 +91,7 @@ namespace getfem {
 if (!parent_mesh && !from.parent_mesh){
   id_ = from.id_;
   type_ = from.type_;
-  partitioning_allowed = from.partitioning_allowed;
+  partitioning_allowed.store(from.partitioning_allowed.load());
   if (from.p) {
 if (!p) p = std::make_shared();
 wp() = from.rp();
@@ -103,13 +103,13 @@ namespace getfem {
   id_ = from.id_;
   type_ = from.type_;
   parent_mesh = from.parent_mesh;
-  partitioning_allowed = from.partitioning_allowed;
+  partitioning_allowed.store(from.partitioning_allowed.load());
 }
 else {
   if (from.p){
 wp() = from.rp();
 type_= from.get_type();
-partitioning_allowed = from.partitioning_allowed;
+partitioning_allowed.store(from.partitioning_allowed.load());
   }
   else if (from.id_ == size_type(-1)) {
 clear();
diff --git a/src/getfem_omp.cc b/src/getfem_omp.cc
index 888e22a..2f13e60 100644
--- a/src/getfem_omp.cc
+++ b/src/getfem_omp.cc
@@ -196,6 +196,8 @@ namespace getfem{
   }
 
   void partition_master::set_nb_partitions(size_type n){
+GMM_ASSERT1 (!partitions_set_by_user,
+ "Number of partitions can be set only once");
 if (n > nb_partitions){
   nb_partitions = n;
   nb_user_threads = true_thread_policy::num_threads();
@@ -239,6 +241,11 @@ namespace getfem{
   }
 
   size_type partition_master::get_current_partition() const {
+GMM_ASSERT2(behaviour == thread_behaviour::partition_threads ?
+true_thread_policy::this_thread() < nb_partitions : true,
+"Requesting current partition for thread " <<
+true_thread_policy::this_thread() <<
+" while number of partitions is " << nb_partitions);
 return behaviour == thread_behaviour::partition_threads ?
current_partition : true_thread_policy::this_thread();
   }
@@ -336,6 +343,10 @@ namespace getfem{
   void parallel_execution(std::function lambda,
   bool iterate_over_partitions){
 parallel_boilerplate boilerplate;
+auto &pm = partition_master::get();
+if (pm.get_nb_partitions() < true_thread_policy::num_threads()){
+  pm.set_nb_partitions(true_thread_policy::num_threads());
+}
 #pragma omp parallel default(shared)
 {
   if (iterate_over_partitions) {
@@ -351,4 +362,4 @@ namespace getfem{
 if (iterate_over_partitions) partition_master::get().rewind_partitions();
   }
 
-}  /* end of namespace getfem. */
+}  /* end of namespace getfem. */
\ No newline at end of file



[Getfem-commits] [getfem-commits] partitions_initiation updated (8bd82f1 -> 467ae55)

2019-02-11 Thread Andriy Andreykiv
andrico pushed a change to branch partitions_initiation.

  from  8bd82f1   thread based partitioning:  - flag in mesh region needs 
to atomic, not distributed,not to depend on the thread policy used  - 
initializing threads to 1, to be able to expand it to the desired number
(setting them to any large number prevents later setting to 1, as shrinking 
partitions is not possible)
   new  467ae55   1) partitioning can be changed only once; 2) flag in the 
region should be atomic; 3) starting from one thread, if more desired, this 
should be specified


Summary of changes:
 src/getfem_mesh_region.cc |  6 +++---
 src/getfem_omp.cc | 13 -
 2 files changed, 15 insertions(+), 4 deletions(-)



Re: [Getfem-commits] What is the best way to add parameter for each direction in term?

2019-02-11 Thread Tetsuo Koyama
Dear GetFEM++ Project

I'm sorry, code was wrong.

model.add_fixed_size_data("rho", 2);
model.set_real_variable("rho")[0] = rho_for_x;
model.set_real_variable("rho")[1] = rho_for_y;

getfem::add_linear_term(model, mim, "rho*u.Test_u", TOP);

Could you anser it? Thank you.

Best Regard Tetsuo

2019年2月11日(月) 17:03 Tetsuo Koyama :
>
> Dear GetFEM++
>
> What is the best way to add parameter for each space direction in term?
> I want to use fixed_size_data as a coefficient of the weak form
> language, because parameter of each direction is different.
> Is it work if the dimension of rho is equal to the dimension of mesh
> in following code?
>
> Code of C++:
> model.add_fixed_size_data("rho", rho);
> getfem::add_linear_term(model, mim, "rho*u.Test_u", TOP);
>
> Best Regard Tetsuo



[Getfem-commits] What is the best way to add parameter for each direction in term?

2019-02-11 Thread Tetsuo Koyama
Dear GetFEM++

What is the best way to add parameter for each space direction in term?
I want to use fixed_size_data as a coefficient of the weak form
language, because parameter of each direction is different.
Is it work if the dimension of rho is equal to the dimension of mesh
in following code?

Code of C++:
model.add_fixed_size_data("rho", rho);
getfem::add_linear_term(model, mim, "rho*u.Test_u", TOP);

Best Regard Tetsuo