Re: [Getfem-commits] merge request for touched_region_for_projected_fem

2021-03-10 Thread Andriy Andreykiv
Thank you, Kostas

On Wed, 10 Mar 2021, 17:08 Konstantinos Poulios, 
wrote:

> Hi Andriy,
>
> Sorry for the delay. I hadn't noticed your previous reply. Your commits
> have been rebased/squashed/merged. All of your changes should be in the
> current master. If you confirm this, you can delete the
> touched_region_for_projected_fem branch yourself.
>
> Thanks for the useful new function.
>
> Best regards
> Kostas
>
> On Tue, Mar 9, 2021 at 9:37 AM Andriy Andreykiv <
> andriy.andrey...@gmail.com> wrote:
>
>> Kostas, hi,
>>
>> Did you have a chance to review my latest commits?
>> Thanks,
>> Andriy
>>
>> On Fri, 5 Mar 2021 at 09:27, Konstantinos Poulios <
>> logar...@googlemail.com> wrote:
>>
>>> Thanks. I see your point about "intersected". I think
>>> "projected_target_region" is a good name.
>>>
>>> If you do this change I can squash and merge your commits.
>>>
>>> Best regards
>>> Kostas
>>>
>>> On Thu, Mar 4, 2021 at 2:06 PM Andriy Andreykiv <
>>> andriy.andrey...@gmail.com> wrote:
>>>
>>>> Hi Konstantinos,
>>>>
>>>> Replaced almost all the auto's. Regarding intersected_target_region,
>>>> that could be, but for me the word intersected would be appropriate if it
>>>> was interpolated_fem where the regions intersect.
>>>> Physically it feels like touch, but I agree that we have touch() in
>>>> context_dependencies which might be confusing.
>>>> Here I feel a need for the concept of projection.  I personally need a
>>>> name that condenses the sentence "region that contains part of the target
>>>> where the source is projected on". Can we say
>>>> projected_target_region? We can also go with supported_target_region()?
>>>>
>>>> Let me know what you think,
>>>>   Andriy
>>>>
>>>>
>>>>
>>>> On Thu, 4 Mar 2021 at 12:38, Konstantinos Poulios <
>>>> logar...@googlemail.com> wrote:
>>>>
>>>>> should we also briefly discuss the name of the function? In
>>>>> mathematical terms I would call it
>>>>>
>>>>> support_region
>>>>>
>>>>> But a more popularized name might be easier to understand in general.
>>>>> However, I do not like "touched" because "touch" is typically used in
>>>>> programming for denoting change in state, so your current name I 
>>>>> understand
>>>>> it as a region that has state A and changes to state B. We could instead
>>>>> call it
>>>>>
>>>>> intersected_target_region
>>>>>
>>>>> or something similar. Other ideas?
>>>>>
>>>>> In general I think we should spend some effort in good names because
>>>>> once a name is in the API it is more difficult to remove.
>>>>>
>>>>> Best regards
>>>>> Kostas
>>>>>
>>>>> On Thu, Mar 4, 2021 at 12:31 PM Konstantinos Poulios <
>>>>> logar...@googlemail.com> wrote:
>>>>>
>>>>>> Hi Andriy,
>>>>>>
>>>>>> Thanks, I see how it can be useful. Could I ask you to reduce the use
>>>>>> of auto for this commit? For example it does not make much sense to use
>>>>>> auto for bool. In general my preference for the GetFEM codebase is to use
>>>>>> auto only if some type is particularly long and makes the code
>>>>>> significantly less readable. Otherwise the type of the variables is 
>>>>>> useful
>>>>>> information for people that will read and try to understand the code 
>>>>>> later.
>>>>>>
>>>>>> There is also a typo in a comment. It should be "Gauss".
>>>>>>
>>>>>> Best regards
>>>>>> Kostas
>>>>>>
>>>>>> On Thu, Mar 4, 2021 at 11:32 AM Andriy Andreykiv <
>>>>>> andriy.andrey...@gmail.com> wrote:
>>>>>>
>>>>>>> Dear Yves and Konstantinus,
>>>>>>>
>>>>>>> Kind request to review and merge touched_region_for_projected_fem
>>>>>>> branch.
>>>>>>> It introduces a method for projected_fem that extracts a region from
>>>>>>> the target that is actually touched by the source.
>>>>>>> I use this region to integrate my mortar terms on.
>>>>>>>
>>>>>>> Best regards,
>>>>>>>   Andriy
>>>>>>>
>>>>>>>
>>>>>>>


Re: [Getfem-commits] merge request for touched_region_for_projected_fem

2021-03-09 Thread Andriy Andreykiv
Kostas, hi,

Did you have a chance to review my latest commits?
Thanks,
Andriy

On Fri, 5 Mar 2021 at 09:27, Konstantinos Poulios 
wrote:

> Thanks. I see your point about "intersected". I think
> "projected_target_region" is a good name.
>
> If you do this change I can squash and merge your commits.
>
> Best regards
> Kostas
>
> On Thu, Mar 4, 2021 at 2:06 PM Andriy Andreykiv <
> andriy.andrey...@gmail.com> wrote:
>
>> Hi Konstantinos,
>>
>> Replaced almost all the auto's. Regarding intersected_target_region, that
>> could be, but for me the word intersected would be appropriate if it was
>> interpolated_fem where the regions intersect.
>> Physically it feels like touch, but I agree that we have touch() in
>> context_dependencies which might be confusing.
>> Here I feel a need for the concept of projection.  I personally need a
>> name that condenses the sentence "region that contains part of the target
>> where the source is projected on". Can we say
>> projected_target_region? We can also go with supported_target_region()?
>>
>> Let me know what you think,
>>   Andriy
>>
>>
>>
>> On Thu, 4 Mar 2021 at 12:38, Konstantinos Poulios <
>> logar...@googlemail.com> wrote:
>>
>>> should we also briefly discuss the name of the function? In mathematical
>>> terms I would call it
>>>
>>> support_region
>>>
>>> But a more popularized name might be easier to understand in general.
>>> However, I do not like "touched" because "touch" is typically used in
>>> programming for denoting change in state, so your current name I understand
>>> it as a region that has state A and changes to state B. We could instead
>>> call it
>>>
>>> intersected_target_region
>>>
>>> or something similar. Other ideas?
>>>
>>> In general I think we should spend some effort in good names because
>>> once a name is in the API it is more difficult to remove.
>>>
>>> Best regards
>>> Kostas
>>>
>>> On Thu, Mar 4, 2021 at 12:31 PM Konstantinos Poulios <
>>> logar...@googlemail.com> wrote:
>>>
>>>> Hi Andriy,
>>>>
>>>> Thanks, I see how it can be useful. Could I ask you to reduce the use
>>>> of auto for this commit? For example it does not make much sense to use
>>>> auto for bool. In general my preference for the GetFEM codebase is to use
>>>> auto only if some type is particularly long and makes the code
>>>> significantly less readable. Otherwise the type of the variables is useful
>>>> information for people that will read and try to understand the code later.
>>>>
>>>> There is also a typo in a comment. It should be "Gauss".
>>>>
>>>> Best regards
>>>> Kostas
>>>>
>>>> On Thu, Mar 4, 2021 at 11:32 AM Andriy Andreykiv <
>>>> andriy.andrey...@gmail.com> wrote:
>>>>
>>>>> Dear Yves and Konstantinus,
>>>>>
>>>>> Kind request to review and merge touched_region_for_projected_fem
>>>>> branch.
>>>>> It introduces a method for projected_fem that extracts a region from
>>>>> the target that is actually touched by the source.
>>>>> I use this region to integrate my mortar terms on.
>>>>>
>>>>> Best regards,
>>>>>   Andriy
>>>>>
>>>>>
>>>>>


Re: [Getfem-commits] merge request for touched_region_for_projected_fem

2021-03-05 Thread Andriy Andreykiv
pushed the changes

On Fri, 5 Mar 2021 at 09:27, Konstantinos Poulios 
wrote:

> Thanks. I see your point about "intersected". I think
> "projected_target_region" is a good name.
>
> If you do this change I can squash and merge your commits.
>
> Best regards
> Kostas
>
> On Thu, Mar 4, 2021 at 2:06 PM Andriy Andreykiv <
> andriy.andrey...@gmail.com> wrote:
>
>> Hi Konstantinos,
>>
>> Replaced almost all the auto's. Regarding intersected_target_region, that
>> could be, but for me the word intersected would be appropriate if it was
>> interpolated_fem where the regions intersect.
>> Physically it feels like touch, but I agree that we have touch() in
>> context_dependencies which might be confusing.
>> Here I feel a need for the concept of projection.  I personally need a
>> name that condenses the sentence "region that contains part of the target
>> where the source is projected on". Can we say
>> projected_target_region? We can also go with supported_target_region()?
>>
>> Let me know what you think,
>>   Andriy
>>
>>
>>
>> On Thu, 4 Mar 2021 at 12:38, Konstantinos Poulios <
>> logar...@googlemail.com> wrote:
>>
>>> should we also briefly discuss the name of the function? In mathematical
>>> terms I would call it
>>>
>>> support_region
>>>
>>> But a more popularized name might be easier to understand in general.
>>> However, I do not like "touched" because "touch" is typically used in
>>> programming for denoting change in state, so your current name I understand
>>> it as a region that has state A and changes to state B. We could instead
>>> call it
>>>
>>> intersected_target_region
>>>
>>> or something similar. Other ideas?
>>>
>>> In general I think we should spend some effort in good names because
>>> once a name is in the API it is more difficult to remove.
>>>
>>> Best regards
>>> Kostas
>>>
>>> On Thu, Mar 4, 2021 at 12:31 PM Konstantinos Poulios <
>>> logar...@googlemail.com> wrote:
>>>
>>>> Hi Andriy,
>>>>
>>>> Thanks, I see how it can be useful. Could I ask you to reduce the use
>>>> of auto for this commit? For example it does not make much sense to use
>>>> auto for bool. In general my preference for the GetFEM codebase is to use
>>>> auto only if some type is particularly long and makes the code
>>>> significantly less readable. Otherwise the type of the variables is useful
>>>> information for people that will read and try to understand the code later.
>>>>
>>>> There is also a typo in a comment. It should be "Gauss".
>>>>
>>>> Best regards
>>>> Kostas
>>>>
>>>> On Thu, Mar 4, 2021 at 11:32 AM Andriy Andreykiv <
>>>> andriy.andrey...@gmail.com> wrote:
>>>>
>>>>> Dear Yves and Konstantinus,
>>>>>
>>>>> Kind request to review and merge touched_region_for_projected_fem
>>>>> branch.
>>>>> It introduces a method for projected_fem that extracts a region from
>>>>> the target that is actually touched by the source.
>>>>> I use this region to integrate my mortar terms on.
>>>>>
>>>>> Best regards,
>>>>>   Andriy
>>>>>
>>>>>
>>>>>


[Getfem-commits] [getfem-commits] branch touched_region_for_projected_fem updated: improving naming

2021-03-05 Thread Andriy Andreykiv
This is an automated email from the git hooks/post-receive script.

andrico pushed a commit to branch touched_region_for_projected_fem
in repository getfem.

The following commit(s) were added to 
refs/heads/touched_region_for_projected_fem by this push:
 new b293efb  improving naming
b293efb is described below

commit b293efbdf2f6631b0dfe5ea3f00a798b0f4c1744
Author: Andriy Andreykiv 
AuthorDate: Fri Mar 5 09:53:22 2021 +0100

improving naming
---
 src/getfem/getfem_projected_fem.h | 2 +-
 src/getfem_projected_fem.cc   | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/getfem/getfem_projected_fem.h 
b/src/getfem/getfem_projected_fem.h
index c08b944..840362f 100644
--- a/src/getfem/getfem_projected_fem.h
+++ b/src/getfem/getfem_projected_fem.h
@@ -144,7 +144,7 @@ namespace getfem {
 
 /** faces and convexes from the target region
  *  that contain at least one Gauss point that is projected by the source 
*/
-mesh_region touched_target_region() const;
+mesh_region projected_target_region() const;
 
 /** return the min/max/mean number of gauss points in the convexes
  *  of the projected mesh_fem */
diff --git a/src/getfem_projected_fem.cc b/src/getfem_projected_fem.cc
index 382f86c..a5f0d68 100644
--- a/src/getfem_projected_fem.cc
+++ b/src/getfem_projected_fem.cc
@@ -795,9 +795,9 @@ namespace getfem {
 return bv;
   }
 
-  mesh_region projected_fem::touched_target_region() const {
+  mesh_region projected_fem::projected_target_region() const {
 context_check();
-mesh_region touched_region;
+mesh_region projected_target;
 for (mr_visitor v(rg_target); !v.finished(); ++v) {
   pintegration_method pim = mim_target.int_method_of_element(v.cv());
   papprox_integration pai = pim->approx_method();
@@ -812,9 +812,9 @@ namespace getfem {
   break;
 }
   }
-  if (isProjectedOn) touched_region.add(v.cv(), v.f());
+  if (isProjectedOn) projected_target.add(v.cv(), v.f());
 }
-return touched_region;
+return projected_target;
   }
 
   void projected_fem::gauss_pts_stats(unsigned , unsigned ,



[Getfem-commits] [getfem-commits] touched_region_for_projected_fem updated (e13a082 -> 3c95fe3)

2021-03-04 Thread Andriy Andreykiv
andrico pushed a change to branch touched_region_for_projected_fem.

from e13a082  projected_fem::touched_target_region()
 new 9c0058d  less auto
 new 3c95fe3  comment spelling


Summary of changes:
 src/getfem/getfem_projected_fem.h |  2 +-
 src/getfem_projected_fem.cc   | 12 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)



Re: [Getfem-commits] merge request for touched_region_for_projected_fem

2021-03-04 Thread Andriy Andreykiv
Hi Konstantinos,

Replaced almost all the auto's. Regarding intersected_target_region, that
could be, but for me the word intersected would be appropriate if it was
interpolated_fem where the regions intersect.
Physically it feels like touch, but I agree that we have touch() in
context_dependencies which might be confusing.
Here I feel a need for the concept of projection.  I personally need a name
that condenses the sentence "region that contains part of the target where
the source is projected on". Can we say
projected_target_region? We can also go with supported_target_region()?

Let me know what you think,
  Andriy



On Thu, 4 Mar 2021 at 12:38, Konstantinos Poulios 
wrote:

> should we also briefly discuss the name of the function? In mathematical
> terms I would call it
>
> support_region
>
> But a more popularized name might be easier to understand in general.
> However, I do not like "touched" because "touch" is typically used in
> programming for denoting change in state, so your current name I understand
> it as a region that has state A and changes to state B. We could instead
> call it
>
> intersected_target_region
>
> or something similar. Other ideas?
>
> In general I think we should spend some effort in good names because once
> a name is in the API it is more difficult to remove.
>
> Best regards
> Kostas
>
> On Thu, Mar 4, 2021 at 12:31 PM Konstantinos Poulios <
> logar...@googlemail.com> wrote:
>
>> Hi Andriy,
>>
>> Thanks, I see how it can be useful. Could I ask you to reduce the use of
>> auto for this commit? For example it does not make much sense to use auto
>> for bool. In general my preference for the GetFEM codebase is to use auto
>> only if some type is particularly long and makes the code significantly
>> less readable. Otherwise the type of the variables is useful information
>> for people that will read and try to understand the code later.
>>
>> There is also a typo in a comment. It should be "Gauss".
>>
>> Best regards
>> Kostas
>>
>> On Thu, Mar 4, 2021 at 11:32 AM Andriy Andreykiv <
>> andriy.andrey...@gmail.com> wrote:
>>
>>> Dear Yves and Konstantinus,
>>>
>>> Kind request to review and merge touched_region_for_projected_fem branch.
>>> It introduces a method for projected_fem that extracts a region from the
>>> target that is actually touched by the source.
>>> I use this region to integrate my mortar terms on.
>>>
>>> Best regards,
>>>   Andriy
>>>
>>>
>>>


[Getfem-commits] (no subject)

2021-03-04 Thread Andriy Andreykiv
branch: touched_region_for_projected_fem
commit 9c0058d2398da11a148029e0b4fad00d1d853e00
Author: Andriy Andreykiv 
AuthorDate: Thu Mar 4 13:57:21 2021 +0100

less auto
---
 src/getfem_projected_fem.cc | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/getfem_projected_fem.cc b/src/getfem_projected_fem.cc
index c83861d..382f86c 100644
--- a/src/getfem_projected_fem.cc
+++ b/src/getfem_projected_fem.cc
@@ -799,12 +799,12 @@ namespace getfem {
 context_check();
 mesh_region touched_region;
 for (mr_visitor v(rg_target); !v.finished(); ++v) {
-  auto pim = mim_target.int_method_of_element(v.cv());
-  auto pai = pim->approx_method();
-  auto start_pt = v.is_face() ? pai->ind_first_point_on_face(v.f()) : 0;
-  auto nb_pts = v.is_face() ? pai->nb_points_on_face(v.f())
-: pai->nb_points_on_convex();
-  auto isProjectedOn = false;
+  pintegration_method pim = mim_target.int_method_of_element(v.cv());
+  papprox_integration pai = pim->approx_method();
+  size_type start_pt = v.is_face() ? pai->ind_first_point_on_face(v.f()) : 
0;
+  size_type nb_pts = v.is_face() ? pai->nb_points_on_face(v.f())
+ : pai->nb_points_on_convex();
+  bool isProjectedOn = false;
   for (size_type ip = 0; ip != nb_pts; ++ip) {
 auto _data = elements.at(v.cv()).gausspt[start_pt + ip];
 if (proj_data.iflags) {



[Getfem-commits] (no subject)

2021-03-04 Thread Andriy Andreykiv
branch: touched_region_for_projected_fem
commit 3c95fe39eb8b1a1b4de5ce6126729a02c2b1528e
Author: Andriy Andreykiv 
AuthorDate: Thu Mar 4 13:58:21 2021 +0100

comment spelling
---
 src/getfem/getfem_projected_fem.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/getfem/getfem_projected_fem.h 
b/src/getfem/getfem_projected_fem.h
index 8eb1378..c08b944 100644
--- a/src/getfem/getfem_projected_fem.h
+++ b/src/getfem/getfem_projected_fem.h
@@ -143,7 +143,7 @@ namespace getfem {
 dal::bit_vector projected_convexes() const;
 
 /** faces and convexes from the target region
- *  that contain at least one guass point that is projected by the source 
*/
+ *  that contain at least one Gauss point that is projected by the source 
*/
 mesh_region touched_target_region() const;
 
 /** return the min/max/mean number of gauss points in the convexes



[Getfem-commits] merge request for touched_region_for_projected_fem

2021-03-04 Thread Andriy Andreykiv
Dear Yves and Konstantinus,

Kind request to review and merge touched_region_for_projected_fem branch.
It introduces a method for projected_fem that extracts a region from the
target that is actually touched by the source.
I use this region to integrate my mortar terms on.

Best regards,
  Andriy


[Getfem-commits] [getfem-commits] branch touched_region_for_projected_fem created (now e13a082)

2021-03-03 Thread Andriy Andreykiv
andrico pushed a change to branch touched_region_for_projected_fem.

  at e13a082  projected_fem::touched_target_region()

This branch includes the following new commits:

 new e13a082  projected_fem::touched_target_region()




[Getfem-commits] (no subject)

2021-03-03 Thread Andriy Andreykiv
branch: touched_region_for_projected_fem
commit e13a0827f7bddb7c557cb3f8506ba6e96496da4d
Author: Andriy Andreykiv 
AuthorDate: Wed Mar 3 20:16:22 2021 +0100

projected_fem::touched_target_region()
---
 src/getfem/getfem_projected_fem.h |  4 
 src/getfem_projected_fem.cc   | 22 ++
 2 files changed, 26 insertions(+)

diff --git a/src/getfem/getfem_projected_fem.h 
b/src/getfem/getfem_projected_fem.h
index ae216b9..8eb1378 100644
--- a/src/getfem/getfem_projected_fem.h
+++ b/src/getfem/getfem_projected_fem.h
@@ -141,6 +141,10 @@ namespace getfem {
 /** return the list of convexes of the projected mesh_fem which
  *  contain at least one gauss point (should be all convexes)! */
 dal::bit_vector projected_convexes() const;
+
+/** faces and convexes from the target region
+ *  that contain at least one guass point that is projected by the source 
*/
+mesh_region touched_target_region() const;
 
 /** return the min/max/mean number of gauss points in the convexes
  *  of the projected mesh_fem */
diff --git a/src/getfem_projected_fem.cc b/src/getfem_projected_fem.cc
index fa73548..c83861d 100644
--- a/src/getfem_projected_fem.cc
+++ b/src/getfem_projected_fem.cc
@@ -795,6 +795,28 @@ namespace getfem {
 return bv;
   }
 
+  mesh_region projected_fem::touched_target_region() const {
+context_check();
+mesh_region touched_region;
+for (mr_visitor v(rg_target); !v.finished(); ++v) {
+  auto pim = mim_target.int_method_of_element(v.cv());
+  auto pai = pim->approx_method();
+  auto start_pt = v.is_face() ? pai->ind_first_point_on_face(v.f()) : 0;
+  auto nb_pts = v.is_face() ? pai->nb_points_on_face(v.f())
+: pai->nb_points_on_convex();
+  auto isProjectedOn = false;
+  for (size_type ip = 0; ip != nb_pts; ++ip) {
+auto _data = elements.at(v.cv()).gausspt[start_pt + ip];
+if (proj_data.iflags) {
+  isProjectedOn = true;
+  break;
+}
+  }
+  if (isProjectedOn) touched_region.add(v.cv(), v.f());
+}
+return touched_region;
+  }
+
   void projected_fem::gauss_pts_stats(unsigned , unsigned ,
   scalar_type ) const {
 std::vector v(mf_source.linked_mesh().nb_allocated_convex());



[Getfem-commits] merge request for msvc_solution_update

2019-07-02 Thread Andriy Andreykiv
Dear Yves and Kostas,

Kind request to review and merge msvc_solution_update.
As the name suggests, I again updated the project files, synchronised the
run-times, etc. So now they work.

Best regards
 Andriy


[Getfem-commits] (no subject)

2019-07-02 Thread Andriy Andreykiv
branch: msvc_solution_update
commit 4f45a6433e95b43f241f141ddcbc9d43bb1d5649
Author: Andriy.Andreykiv 
Date:   Tue Jul 2 14:33:13 2019 +0200

updating all MSVC projects
---
 msvc/bilaplacian/bilaplacian.vcxproj   | 4 +---
 msvc/elastostatic/elastostatic.vcxproj | 4 +---
 msvc/libgetfem/libgetfem.vcxproj   | 3 +--
 msvc/libgetfemint/libgetfemint.vcxproj | 4 +---
 msvc/matlab_interface/matlab_interface.vcxproj | 4 +---
 msvc/poly/poly.vcxproj | 3 +--
 msvc/superlu/superlu.vcxproj   | 3 +--
 msvc/test_assembly/test_assembly.vcxproj   | 4 +---
 msvc/test_kdtree/test_kdtree.vcxproj   | 3 +--
 msvc/test_laplacian_with_bricks/test_laplacian_with_bricks.vcxproj | 3 +--
 msvc/test_level_set_contact/test_level_set_contact.vcxproj | 3 +--
 11 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/msvc/bilaplacian/bilaplacian.vcxproj 
b/msvc/bilaplacian/bilaplacian.vcxproj
index db653bd..9246ef4 100755
--- a/msvc/bilaplacian/bilaplacian.vcxproj
+++ b/msvc/bilaplacian/bilaplacian.vcxproj
@@ -28,7 +28,7 @@
 Application
 Unicode
 v141
-Sequential
+No
   
   
   
@@ -58,7 +58,6 @@
   
   
   Level3
-  MultiThreadedDebug
 
 
   true
@@ -71,7 +70,6 @@
   true
   
WIN32;_CONSOLE;%(PreprocessorDefinitions)
   Default
-  MultiThreaded
   true
   
   
diff --git a/msvc/elastostatic/elastostatic.vcxproj 
b/msvc/elastostatic/elastostatic.vcxproj
index 56dc690..cf7469b 100755
--- a/msvc/elastostatic/elastostatic.vcxproj
+++ b/msvc/elastostatic/elastostatic.vcxproj
@@ -28,7 +28,7 @@
 Application
 Unicode
 v141
-Sequential
+No
   
   
   
@@ -59,7 +59,6 @@
   
   Level3
   ProgramDatabase
-  MultiThreadedDebug
 
 
   true
@@ -71,7 +70,6 @@
   MaxSpeed
   true
   Default
-  MultiThreaded
   true
   
   
diff --git a/msvc/libgetfem/libgetfem.vcxproj b/msvc/libgetfem/libgetfem.vcxproj
index 95d87ee..c95eddb 100755
--- a/msvc/libgetfem/libgetfem.vcxproj
+++ b/msvc/libgetfem/libgetfem.vcxproj
@@ -51,13 +51,12 @@
   
   
 
-  
GETFEM_HAS_OPENMP;_DEBUG;_LIB;WIN32;_SCL_SECURE_NO_DEPRECATE
+  
_DEBUG;_LIB;WIN32;_SCL_SECURE_NO_DEPRECATE
   
   
   Level3
   Default
   NotSet
-  MultiThreadedDebug
   /bigobj %(AdditionalOptions)
 
 
diff --git a/msvc/libgetfemint/libgetfemint.vcxproj 
b/msvc/libgetfemint/libgetfemint.vcxproj
index 4d3206d..22cd643 100755
--- a/msvc/libgetfemint/libgetfemint.vcxproj
+++ b/msvc/libgetfemint/libgetfemint.vcxproj
@@ -136,7 +136,7 @@
 StaticLibrary
 Unicode
 v141
-Sequential
+No
   
   
   
@@ -167,7 +167,6 @@
   
   Level3
   ProgramDatabase
-  MultiThreadedDebug
 
   
   
@@ -175,7 +174,6 @@
   
..\qhull-2011.1\src;..\muparser_v134\include;..\..\interface\src;%(AdditionalIncludeDirectories)
   
_LIB;WIN32;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE
   Default
-  MultiThreaded
   true
   
   
diff --git a/msvc/matlab_interface/matlab_interface.vcxproj 
b/msvc/matlab_interface/matlab_interface.vcxproj
index 7cfd382..58b0606 100755
--- a/msvc/matlab_interface/matlab_interface.vcxproj
+++ b/msvc/matlab_interface/matlab_interface.vcxproj
@@ -28,7 +28,7 @@
 DynamicLibrary
 Unicode
 v141
-Sequential
+No
   
   
   
@@ -62,7 +62,6 @@
   Level3
   ProgramDatabase
   
4018;%(DisableSpecificWarnings)
-  MultiThreadedDebug
 
 
   /export:mexFunction 
/LIBPATH:"P:\PROGRA~2\MATLAB\R2010b\extern\lib\win32\microsoft" libmx.lib 
libmex.lib libmat.lib %(AdditionalOptions)
@@ -78,7 +77,6 @@
   true
   P:\Program Files 
(x86)\MATLAB\R2010b\extern\include;$(SolutionDir)/../interface/src;%(AdditionalIncludeDirectories)
   
WIN32;_LIB;MATLAB_RELEASE=14;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
-  MultiThreaded
   true
   
   
diff --git a/msvc/poly/poly.vcxproj b/msvc/poly/poly.vcxproj
index 4f068c9..0da3fb6 100755
--- a/msvc/poly/poly.vcxproj
+++ b/msvc/poly/poly.vcxproj
@@ -28,7 +28,7 @@
 Application
 Unicode
 v141
-Sequential
+No
   
   
   
@@ -60,7 +60,6 @@
   
   Level3
   ProgramDatabase
-  MultiThreadedDebug
 
 
   true
diff --git a/msvc/superlu/superlu.vcxproj b/msvc/superlu/superlu.vcxproj
index 4172b2e..33189fe 100755
--- a/msvc/superlu/superlu.vcxproj
+++ b/msvc/superlu/superlu.vcxproj
@@ -28,7 +28,7 @@
 StaticLibrary
 Unicode
 v141
-Sequential
+No
   
   
   
@@ -62,7 +62,6 @@
   ProgramDatabase
   CompileAsC
   
4244;%(DisableSpecificWarnings)
-  MultiThreadedDebug
 
   
   

[Getfem-commits] [getfem-commits] branch msvc_solution_update created (now 4f45a64)

2019-07-02 Thread Andriy Andreykiv
andrico pushed a change to branch msvc_solution_update.

at  4f45a64   updating all MSVC projects

This branch includes the following new commits:

   new  4f45a64   updating all MSVC projects




[Getfem-commits] (no subject)

2019-06-06 Thread Andriy Andreykiv
branch: csr_matrix_and_memory_fixes
commit 06165410f54c1c82ee82903906c6497cd535ce83
Author: Andriy.Andreykiv 
Date:   Thu Jun 6 14:26:43 2019 +0200

allowing gmm::csc_matrix and gmm::csr_matrix to be also templetized by 
index type. This was necessary to interface them with Intel's MKL, which 
requires int for indexes.
---
 src/gmm/gmm_inoutput.h | 42 +++---
 src/gmm/gmm_matrix.h   | 94 --
 2 files changed, 66 insertions(+), 70 deletions(-)

diff --git a/src/gmm/gmm_inoutput.h b/src/gmm/gmm_inoutput.h
index cca7027..ea2c277 100644
--- a/src/gmm/gmm_inoutput.h
+++ b/src/gmm/gmm_inoutput.h
@@ -124,12 +124,12 @@ namespace gmm {
 /** open filename and reads header */
 void open(const char *filename);
 /** read the opened file */
-template  void read(csc_matrix& A);
+template  void 
read(csc_matrix& A);
 template  void read(MAT ) IS_DEPRECATED;
-template 
-static void write(const char *filename, const csc_matrix& A);
-template 
-static void write(const char *filename, const csc_matrix& A,
+template 
+static void write(const char *filename, const csc_matrix& A);
+template 
+static void write(const char *filename, const csc_matrix& A,
  const std::vector );
 template  
 static void write(const char *filename,
@@ -324,8 +324,8 @@ namespace gmm {
   }
 
   /* only valid for double and complex csc matrices */
-  template  void
-  HarwellBoeing_IO::read(csc_matrix& A) {
+  template  void
+  HarwellBoeing_IO::read(csc_matrix& A) {
 
 // typedef typename csc_matrix::IND_TYPE IND_TYPE;
 
@@ -531,17 +531,17 @@ namespace gmm {
 return 1;
   }
   
-  template  void
+  template  void
   HarwellBoeing_IO::write(const char *filename,
- const csc_matrix& A) {
+ const csc_matrix& A) {
 write(filename, csc_matrix_ref
  ([0], [0], [0], A.nr, A.nc));
   }
 
-  template  void
+  template  void
   HarwellBoeing_IO::write(const char *filename,
- const csc_matrix& A,
+ const csc_matrix& A,
  const std::vector ) {
 write(filename, csc_matrix_ref
@@ -593,9 +593,9 @@ namespace gmm {
   /** save a "double" or "std::complex" csc matrix into a
   HarwellBoeing file
   */
-  template  inline void
+  template  inline void
   Harwell_Boeing_save(const std::string ,
- const csc_matrix& A)
+ const csc_matrix& A)
   { HarwellBoeing_IO::write(filename.c_str(), A); }
 
   /** save a reference on "double" or "std::complex" csc matrix
@@ -631,8 +631,8 @@ namespace gmm {
   /** load a "double" or "std::complex" csc matrix from a
   HarwellBoeing file
   */
-  template  void
-  Harwell_Boeing_load(const std::string , csc_matrix& A) {
+  template  void
+  Harwell_Boeing_load(const std::string , csc_matrix& A) {
 HarwellBoeing_IO h(filename.c_str()); h.read(A);
   }
 
@@ -1022,8 +1022,8 @@ namespace gmm {
 /* read opened file */
 template  void read(Matrix );
 /* write a matrix */
-template  static void 
-write(const char *filename, const csc_matrix& A);  
+template  static void 
+write(const char *filename, const csc_matrix& A);  
 template  static void 
 write(const char *filename,
  const csc_matrix_ref& A);  
@@ -1038,8 +1038,8 @@ namespace gmm {
 mm.read(A);
   }
   /** write a matrix-market file */
-  template  void
-  MatrixMarket_save(const char *filename, const csc_matrix& A) {
+  template  void
+  MatrixMarket_save(const char *filename, const csc_matrix& A) {
 MatrixMarket_IO mm; mm.write(filename, A);
   }
 
@@ -1106,8 +1106,8 @@ namespace gmm {
 }
   }
 
-  template  void 
-  MatrixMarket_IO::write(const char *filename, const csc_matrix& A) {
+  template  void 
+  MatrixMarket_IO::write(const char *filename, const csc_matrix& A) {
 write(filename, csc_matrix_ref
  ([0], [0], [0], A.nr, A.nc));
diff --git a/src/gmm/gmm_matrix.h b/src/gmm/gmm_matrix.h
index 3b133bb..634019c 100644
--- a/src/gmm/gmm_matrix.h
+++ b/src/gmm/gmm_matrix.h
@@ -497,9 +497,8 @@ namespace gmm
   /*  */
   /*  */
 
-  template 
+  template 
   struct csc_matrix {
-typedef unsigned int IND_TYPE;
 
 std::vector pr;
 std::vector ir;
@@ -519,7 +518,7 @@ namespace gmm
 void init_with(const csc_matrix_ref& B)
 { init_with_good_format(B); }
 template 
-void init_with(const csc_matrix& B)
+void init_with(const csc_matrix& B)
 { init_with_good_format(B); }
 
 void init_with_identity(size_type n);
@@ -529,7 +528,7 @@ namespace gmm
 
 size_type nrows(void) const { return nr; }
 size_type ncols(void) const { return nc; }
-void swap(csc_matrix ) {
+void swap(csc_matrix ) {
   

[Getfem-commits] (no subject)

2019-06-06 Thread Andriy Andreykiv
branch: csr_matrix_and_memory_fixes
commit f222414c84e8294857a5f1e7975b2ef06a024a01
Author: Andriy.Andreykiv 
Date:   Thu Jun 6 14:25:09 2019 +0200

preventing container out of bound access
---
 src/getfem/getfem_accumulated_distro.h |  4 ++--
 src/gmm/gmm_vector.h   | 34 ++
 2 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/src/getfem/getfem_accumulated_distro.h 
b/src/getfem/getfem_accumulated_distro.h
index f323809..ebf8226 100644
--- a/src/getfem/getfem_accumulated_distro.h
+++ b/src/getfem/getfem_accumulated_distro.h
@@ -213,8 +213,8 @@ namespace detail {
   }
 )
 //erase every second item , as it was already added
-for (auto it = begin(to_add);
- next(it) < end(to_add);
+for (auto it = begin(to_add), ite = end(to_add);
+ it != end(to_add) && next(it) != end(to_add);
  it = to_add.erase(next(it)));
   }
 }
diff --git a/src/gmm/gmm_vector.h b/src/gmm/gmm_vector.h
index dbc4029..19b4a27 100644
--- a/src/gmm/gmm_vector.h
+++ b/src/gmm/gmm_vector.h
@@ -1212,15 +1212,33 @@ namespace gmm {
 
 v2.base_resize(nbc);
 it3 = v2.begin() + old_nbc;
-it2 = v2.end(); ite2 = v2.begin();
-it1 = vect_end(v1); ite1 = vect_const_begin(v1);
-while (it1 != ite1 && it3 != ite2) {
-  --it3; --it1; --it2;
-  if (it3->c > it1.index()) { *it2 = *it3; ++it1; }
-  else if (it3->c == it1.index()) { *it2=*it3; it2->e+=*it1; }
-  else { it2->c = it1.index(); it2->e = *it1; ++it3; }
+it2 = v2.end();
+ite2 = v2.begin();
+it1 = vect_end(v1);
+ite1 = vect_const_begin(v1);
+while (it1 != ite1 && it2 != ite2 && it3 != ite2){
+  --it3;
+  --it1;
+  --it2;
+  if (it3->c > it1.index()) {
+*it2 = *it3;
+++it1;
+  }
+  else if (it3->c == it1.index()) {
+*it2=*it3;
+it2->e+=*it1;
+  }
+  else {
+it2->c = it1.index();
+it2->e = *it1; ++it3;
+  }
+}
+while (it1 != ite1 && it2 != ite2) {
+  --it1;
+  --it2;
+  it2->c = it1.index();
+  it2->e = *it1;
 }
-while (it1 != ite1) { --it1; --it2; it2->c = it1.index(); it2->e = *it1; }
   }
 
   template  void copy(const V , rsvector ) {



[Getfem-commits] csr_matrix_and_memory_fixes merge request

2019-06-06 Thread Andriy Andreykiv
Dear Yves and Kostas,

Kind request to review and merge csr_matrix_and_memory_fixes.
Here I made small fixes for out of bound array access and allow
templatesation of index type for GMM CSR and CSC matrices.
We needed this to interface those matrix types with Intel MKL, that
requires integer as index type.

Thank you in advance,
  Andriy


[Getfem-commits] [getfem-commits] branch csr_matrix_and_memory_fixes created (now 0616541)

2019-06-06 Thread Andriy Andreykiv
andrico pushed a change to branch csr_matrix_and_memory_fixes.

at  0616541   allowing gmm::csc_matrix and gmm::csr_matrix to be also 
templetized by index type. This was necessary to interface them with Intel's 
MKL, which requires int for indexes.

This branch includes the following new commits:

   new  f222414   preventing container out of bound access
   new  0616541   allowing gmm::csc_matrix and gmm::csr_matrix to be also 
templetized by index type. This was necessary to interface them with Intel's 
MKL, which requires int for indexes.




[Getfem-commits] (no subject)

2019-05-14 Thread Andriy Andreykiv
branch: c14_complience
commit ab44c49447303222a92bcfbfd4df677b78bbb141
Author: Andriy.Andreykiv 
Date:   Mon May 13 15:50:15 2019 +0200

replacing #pragma omp critical with a macro that hides omp in serial build
---
 src/getfem/getfem_interpolation.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/getfem/getfem_interpolation.h 
b/src/getfem/getfem_interpolation.h
index 51e2e2a..7987ace 100644
--- a/src/getfem/getfem_interpolation.h
+++ b/src/getfem/getfem_interpolation.h
@@ -713,7 +713,7 @@ namespace getfem {
 mf_source, mf_target, U, V_thrd, M, 0, extrapolation, EPS,
 rg_source, rg_target);
 
-  #pragma omp critical
+  GLOBAL_OMP_GUARD
 for (size_type i = 0; i < V_thrd.size(); ++i) {
   if (gmm::abs(V_thrd[i]) > EPS) V[i] = V_thrd[i];
 }



[Getfem-commits] (no subject)

2019-05-14 Thread Andriy Andreykiv
branch: c14_complience
commit 1de83096b5972146568c8562b6d3b3c418f37f22
Author: Andriy.Andreykiv 
Date:   Tue May 14 11:23:55 2019 +0200

removing derivation of operators from public std::binary_function, which is deprecated in C++14 as well as replacing bind functions with 
lambda's
---
 src/getfem/bgeot_poly_composite.h |  5 ++---
 src/getfem/bgeot_small_vector.h   |  4 ++--
 src/getfem/bgeot_sparse_tensors.h |  4 ++--
 src/getfem/dal_tree_sorted.h  |  3 +--
 src/gmm/gmm_algobase.h| 45 +--
 5 files changed, 27 insertions(+), 34 deletions(-)

diff --git a/src/getfem/bgeot_poly_composite.h 
b/src/getfem/bgeot_poly_composite.h
index 19eae27..5fb79af 100644
--- a/src/getfem/bgeot_poly_composite.h
+++ b/src/getfem/bgeot_poly_composite.h
@@ -52,15 +52,14 @@ namespace bgeot {
 
   /// A comparison function for bgeot::base_node
   struct imbricated_box_less
-: public std::binary_function
-  { 
+  {
 mutable int exp_max, exp_min;
 mutable scalar_type c_max;
 unsigned base;
 
 /// comparaison function
 int operator()(const base_node , const base_node ) const;
-
+
 imbricated_box_less(unsigned ba = 10, int emi = -15, int ema = -2) {
   base = ba; exp_max = ema; exp_min = emi;
   c_max = pow(double(base), double(-exp_max));
diff --git a/src/getfem/bgeot_small_vector.h b/src/getfem/bgeot_small_vector.h
index 12cd4fc..c909c90 100644
--- a/src/getfem/bgeot_small_vector.h
+++ b/src/getfem/bgeot_small_vector.h
@@ -236,7 +236,7 @@ namespace bgeot {
 small_vector operator-() const 
 { return -1.*(*this); }
 small_vector operator*(T v) const 
-{ return small_vector(*this, std::bind2nd(std::multiplies(),v)); }
+{return small_vector(*this, [](const auto ) {return v * x;});}
 small_vector operator/(T v) const { return (*this)*(T(1)/v); }
 small_vector& operator+=(const small_vector& other) {
   const_iterator b = other.begin(); iterator it = begin(); 
@@ -333,7 +333,7 @@ namespace bgeot {
 { return -1.*(*this); }
 
 small_vector operator*(T v) const 
-{ return small_vector(*this, std::bind2nd(std::multiplies(),v)); }
+{return small_vector(*this, [](const auto ) {return v * x;});}
 
 small_vector operator/(T v) const { return (*this)*(T(1)/v); }
 
diff --git a/src/getfem/bgeot_sparse_tensors.h 
b/src/getfem/bgeot_sparse_tensors.h
index 0f45e22..fa7aefe 100644
--- a/src/getfem/bgeot_sparse_tensors.h
+++ b/src/getfem/bgeot_sparse_tensors.h
@@ -174,8 +174,8 @@ namespace bgeot {
 void unset_card() const { card_uptodate = false; }
 index_type card(bool just_look=false) const {   
   if (!card_uptodate || just_look) {
-   index_type c = index_type(std::count_if(m.begin(), m.end(), 
- std::bind2nd(std::equal_to(),true)));
+index_type c = index_type(std::count_if(m.begin(), m.end(),
+  [](const auto ) {return x == true;}));
if (just_look) return c;
card_ = c;
   }
diff --git a/src/getfem/dal_tree_sorted.h b/src/getfem/dal_tree_sorted.h
index 0ae6419..48745ee 100644
--- a/src/getfem/dal_tree_sorted.h
+++ b/src/getfem/dal_tree_sorted.h
@@ -736,8 +736,7 @@ namespace dal {
   /* * */
   /* pas completement satisfaisant. A utiliser avec precautions.   */
 
-  template struct less_index
-: public std::binary_function {
+  template struct less_index{
 const TAB *tab;
 COMP compare;
 mutable const T *search_elt;
diff --git a/src/gmm/gmm_algobase.h b/src/gmm/gmm_algobase.h
index 64a859d..722fac0 100644
--- a/src/gmm/gmm_algobase.h
+++ b/src/gmm/gmm_algobase.h
@@ -49,39 +49,36 @@ namespace gmm {
   /* * */
   
   template 
-struct less : public std::binary_function {
+struct less {
 inline int operator()(const T& x, const T& y) const
 { return (x < y) ? -1 : ((y < x) ? 1 : 0); }
   };
 
-  template<> struct less : public std::binary_function
-  { int operator()(int x, int y) const { return x-y; } };
-  template<> struct less : public std::binary_function
-  { int operator()(char x, char y) const { return int(x-y); } };
-  template<> struct less : public std::binary_function
-  { int operator()(short x, short y) const { return int(x-y); } };
-  template<> struct less
- : public std::binary_function {
+  template<> struct less {
+int operator()(int x, int y) const { return x-y; } };
+  template<> struct less {
+int operator()(char x, char y) const { return int(x-y); } };
+  template<> struct less {
+int operator()(short x, short y) const { return int(x-y); } };
+  template<> struct less {
 int operator()(unsigned char x, unsigned char y) const
 { return int(x)-int(y); }
   };
   
 
   template 
-struct greater : public std::binary_function {
+struct greater {
 inline int 

[Getfem-commits] (no subject)

2019-05-14 Thread Andriy Andreykiv
branch: c14_complience
commit 7b85d5cebd98407b24de6f42cddb5ebfa658e60a
Author: Andriy.Andreykiv 
Date:   Tue May 14 11:26:17 2019 +0200

updating MSVC solution to Visual Studio 2017. Fixing run-time options, 
updating file lists
---
 msvc/bilaplacian/bilaplacian.vcxproj   | 2 +-
 msvc/common_debug_settings.props   | 1 +
 msvc/common_release_settings.props | 5 +++--
 msvc/elastostatic/elastostatic.vcxproj | 2 +-
 msvc/libgetfem/libgetfem.vcxproj   | 7 +++
 msvc/libgetfemint/libgetfemint.vcxproj | 2 +-
 msvc/matlab_interface/matlab_interface.vcxproj | 2 +-
 msvc/poly/poly.vcxproj | 3 +--
 msvc/superlu/superlu.vcxproj   | 3 +--
 msvc/test_assembly/test_assembly.vcxproj   | 2 +-
 msvc/test_kdtree/test_kdtree.vcxproj   | 3 +--
 msvc/test_laplacian_with_bricks/test_laplacian_with_bricks.vcxproj | 5 +++--
 msvc/test_level_set_contact/test_level_set_contact.vcxproj | 3 +--
 13 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/msvc/bilaplacian/bilaplacian.vcxproj 
b/msvc/bilaplacian/bilaplacian.vcxproj
index 4175408..db653bd 100755
--- a/msvc/bilaplacian/bilaplacian.vcxproj
+++ b/msvc/bilaplacian/bilaplacian.vcxproj
@@ -22,7 +22,7 @@
 Unicode
 true
 v141
-Sequential
+No
   
   
 Application
diff --git a/msvc/common_debug_settings.props b/msvc/common_debug_settings.props
index 345d91f..37f876f 100644
--- a/msvc/common_debug_settings.props
+++ b/msvc/common_debug_settings.props
@@ -17,6 +17,7 @@
   EditAndContinue
   
4190;4355;4503;4800;%(DisableSpecificWarnings)
   MultiThreadedDebugDLL
+  stdcpp14
 
   
 
\ No newline at end of file
diff --git a/msvc/common_release_settings.props 
b/msvc/common_release_settings.props
index 9f930ed..834f274 100644
--- a/msvc/common_release_settings.props
+++ b/msvc/common_release_settings.props
@@ -7,11 +7,11 @@
   
 
   /MP %(AdditionalOptions)
-  Full
+  MaxSpeed
   Speed
   
..;..\..\src;..\..;%(AdditionalIncludeDirectories)
   
WIN32;_SECURE_SCL=0;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)
-  EnableFastChecks
+  Default
   
StreamingSIMDExtensions2
   Fast
   Level3
@@ -19,6 +19,7 @@
   
4190;4355;4503;4800;%(DisableSpecificWarnings)
   AnySuitable
   true
+  stdcpp14
 
   
 
\ No newline at end of file
diff --git a/msvc/elastostatic/elastostatic.vcxproj 
b/msvc/elastostatic/elastostatic.vcxproj
index dce857c..56dc690 100755
--- a/msvc/elastostatic/elastostatic.vcxproj
+++ b/msvc/elastostatic/elastostatic.vcxproj
@@ -22,7 +22,7 @@
 Unicode
 true
 v141
-Sequential
+No
   
   
 Application
diff --git a/msvc/libgetfem/libgetfem.vcxproj b/msvc/libgetfem/libgetfem.vcxproj
index 57457f0..95d87ee 100755
--- a/msvc/libgetfem/libgetfem.vcxproj
+++ b/msvc/libgetfem/libgetfem.vcxproj
@@ -22,13 +22,13 @@
 Unicode
 true
 v141
-Sequential
+No
   
   
 StaticLibrary
 Unicode
 v141
-Sequential
+No
   
   
   
@@ -51,7 +51,7 @@
   
   
 
-  
_DEBUG;_LIB;WIN32;_SCL_SECURE_NO_DEPRECATE
+  
GETFEM_HAS_OPENMP;_DEBUG;_LIB;WIN32;_SCL_SECURE_NO_DEPRECATE
   
   
   Level3
@@ -68,7 +68,6 @@
   MaxSpeed
   true
   
_LIB;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE
-  MultiThreaded
   true
   
   
diff --git a/msvc/libgetfemint/libgetfemint.vcxproj 
b/msvc/libgetfemint/libgetfemint.vcxproj
index e1564aa..4d3206d 100755
--- a/msvc/libgetfemint/libgetfemint.vcxproj
+++ b/msvc/libgetfemint/libgetfemint.vcxproj
@@ -130,7 +130,7 @@
 Unicode
 true
 v141
-Sequential
+No
   
   
 StaticLibrary
diff --git a/msvc/matlab_interface/matlab_interface.vcxproj 
b/msvc/matlab_interface/matlab_interface.vcxproj
index b009e1c..7cfd382 100755
--- a/msvc/matlab_interface/matlab_interface.vcxproj
+++ b/msvc/matlab_interface/matlab_interface.vcxproj
@@ -22,7 +22,7 @@
 Unicode
 true
 v141
-Sequential
+No
   
   
 DynamicLibrary
diff --git a/msvc/poly/poly.vcxproj b/msvc/poly/poly.vcxproj
index f09b62d..4f068c9 100755
--- a/msvc/poly/poly.vcxproj
+++ b/msvc/poly/poly.vcxproj
@@ -22,7 +22,7 @@
 Unicode
 true
 v141
-Sequential
+No
   
   
 Application
@@ -73,7 +73,6 @@
   true
   
WIN32;_CONSOLE;%(PreprocessorDefinitions)
   Default
-  MultiThreaded
   true
   
   
diff --git a/msvc/superlu/superlu.vcxproj b/msvc/superlu/superlu.vcxproj
index c59792e..4172b2e 100755
--- a/msvc/superlu/superlu.vcxproj
+++ b/msvc/superlu/superlu.vcxproj
@@ -22,7 +22,7 @@
 

[Getfem-commits] (no subject)

2019-05-14 Thread Andriy Andreykiv
branch: c14_complience
commit 48afebe0a7e924b1e2b18663614e0a6ef66305d6
Author: Andriy.Andreykiv 
Date:   Tue May 14 11:24:50 2019 +0200

yet another replacement of bind with lambda
---
 interface/src/gf_mesh_fem_get.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/interface/src/gf_mesh_fem_get.cc b/interface/src/gf_mesh_fem_get.cc
index 21d9587..aa66ad5 100644
--- a/interface/src/gf_mesh_fem_get.cc
+++ b/interface/src/gf_mesh_fem_get.cc
@@ -136,7 +136,7 @@ non_conformal_dof(getfem::mesh_fem , mexargs_in , 
mexargs_out ) {
   iarray w = out.pop().create_iarray_h(
 unsigned(std::count_if(dcnt.begin(),
dcnt.end(),
-   
std::bind2nd(std::equal_to(),1;
+   [](const auto ) {return x == 1;})));
   size_type i,j=0;
   /*
   std::copy_if(dcnt.begin(), dcnt.end(),



[Getfem-commits] (no subject)

2019-05-14 Thread Andriy Andreykiv
branch: c14_complience
commit 8f0bff8150fd8d857ffb5bbda9552a52c7f425d2
Author: Andriy.Andreykiv 
Date:   Mon May 13 15:49:31 2019 +0200

updating msvc projects and solution to the latest source and Visual Studio 
2017
---
 msvc/bilaplacian/bilaplacian.vcxproj   |  8 +++---
 msvc/elastostatic/elastostatic.vcxproj |  8 +++---
 msvc/gmm/gmm_arch_config.h | 12 
 msvc/libgetfem/libgetfem.vcxproj   | 33 +++---
 msvc/libgetfemint/libgetfemint.vcxproj | 12 
 msvc/matlab_interface/matlab_interface.vcxproj |  8 +++---
 msvc/poly/poly.vcxproj |  8 +++---
 msvc/superlu/superlu.vcxproj   |  8 +++---
 msvc/test_assembly/test_assembly.vcxproj   |  8 +++---
 msvc/test_kdtree/test_kdtree.vcxproj   |  8 +++---
 .../test_laplacian_with_bricks.vcxproj |  8 +++---
 .../test_level_set_contact.vcxproj |  8 +++---
 12 files changed, 77 insertions(+), 52 deletions(-)

diff --git a/msvc/bilaplacian/bilaplacian.vcxproj 
b/msvc/bilaplacian/bilaplacian.vcxproj
index d212b7f..4175408 100755
--- a/msvc/bilaplacian/bilaplacian.vcxproj
+++ b/msvc/bilaplacian/bilaplacian.vcxproj
@@ -1,5 +1,5 @@
 
-http://schemas.microsoft.com/developer/msbuild/2003;>
+http://schemas.microsoft.com/developer/msbuild/2003;>
   
 
   Debug
@@ -14,20 +14,20 @@
 {6CFAAB4C-BE69-4504-B813-D28A2BFA8599}
 bilaplacian
 Win32Proj
-8.1
+10.0.17763.0
   
   
   
 Application
 Unicode
 true
-v120
+v141
 Sequential
   
   
 Application
 Unicode
-v120
+v141
 Sequential
   
   
diff --git a/msvc/elastostatic/elastostatic.vcxproj 
b/msvc/elastostatic/elastostatic.vcxproj
index b26e87d..dce857c 100755
--- a/msvc/elastostatic/elastostatic.vcxproj
+++ b/msvc/elastostatic/elastostatic.vcxproj
@@ -1,5 +1,5 @@
 
-http://schemas.microsoft.com/developer/msbuild/2003;>
+http://schemas.microsoft.com/developer/msbuild/2003;>
   
 
   Debug
@@ -14,20 +14,20 @@
 {8119EF46-FA9B-4AAC-B207-99EBA7FBB12E}
 elastostatic
 Win32Proj
-8.1
+10.0.17763.0
   
   
   
 Application
 Unicode
 true
-v120
+v141
 Sequential
   
   
 Application
 Unicode
-v120
+v141
 Sequential
   
   
diff --git a/msvc/gmm/gmm_arch_config.h b/msvc/gmm/gmm_arch_config.h
new file mode 100644
index 000..30d6938
--- /dev/null
+++ b/msvc/gmm/gmm_arch_config.h
@@ -0,0 +1,12 @@
+#ifndef GMM_GMM_ARCH_CONFIG_H
+#define GMM_GMM_ARCH_CONFIG_H 1
+ 
+#define GMM_HAVE_BOOST
+#define GMM_HAVE_OPENMP
+
+/* Define to 1 if you have the `qhull' library (-lqhull). */
+//#define GMM_HAVE_LIBQHULL
+#define GMM_USES_BLAS
+#define GMM_VERSION "5.3"
+
+#endif
diff --git a/msvc/libgetfem/libgetfem.vcxproj b/msvc/libgetfem/libgetfem.vcxproj
index 68cdbb3..57457f0 100755
--- a/msvc/libgetfem/libgetfem.vcxproj
+++ b/msvc/libgetfem/libgetfem.vcxproj
@@ -1,5 +1,5 @@
 
-http://schemas.microsoft.com/developer/msbuild/2003;>
+http://schemas.microsoft.com/developer/msbuild/2003;>
   
 
   Debug
@@ -14,20 +14,20 @@
 {6EEE3C43-27B3-4B9B-A9DF-B5D7F4278D47}
 libgetfem
 Win32Proj
-8.1
+10.0.17763.0
   
   
   
 StaticLibrary
 Unicode
 true
-v120
+v141
 Sequential
   
   
 StaticLibrary
 Unicode
-v120
+v141
 Sequential
   
   
@@ -51,7 +51,7 @@
   
   
 
-  
GETFEM_HAVE_MUPARSER_H;GETFEM_HAVE_QHULL_QHULL_H;_DEBUG;_LIB;WIN32;_SCL_SECURE_NO_DEPRECATE
+  
_DEBUG;_LIB;WIN32;_SCL_SECURE_NO_DEPRECATE
   
   
   Level3
@@ -67,7 +67,7 @@
 
   MaxSpeed
   true
-  
GETFEM_HAVE_MUPARSER_H;GETFEM_HAVE_QHULL_QHULL_H;_LIB;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE
+  
_LIB;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE
   MultiThreaded
   true
   
@@ -105,6 +105,7 @@
 
 
 
+
 
 
 
@@ -114,6 +115,7 @@
 
 
 
+
 
 
 
@@ -135,6 +137,10 @@
 
 
 
+
+
+
+
 
 
 
@@ -145,6 +151,7 @@
 
 
 
+
 
 
 
@@ -171,8 +178,6 @@
 
 
 
-
-
 
 
 
@@ -187,6 +192,7 @@
 
 
 
+
 
 
 
@@ -244,6 +250,7 @@
 
 
 
+
 
 
 
@@ -263,7 +270,12 @@
 
 
 
-
+
+
+
+
+
+
 
 
 
@@ -271,10 +283,11 @@
 
 
 
-
+
 
 
 
+
 
 
 
diff --git a/msvc/libgetfemint/libgetfemint.vcxproj 
b/msvc/libgetfemint/libgetfemint.vcxproj
index 6c13a45..e1564aa 100755
--- a/msvc/libgetfemint/libgetfemint.vcxproj
+++ b/msvc/libgetfemint/libgetfemint.vcxproj
@@ -1,5 +1,5 @@
 
-http://schemas.microsoft.com/developer/msbuild/2003;>
+http://schemas.microsoft.com/developer/msbuild/2003;>
  

[Getfem-commits] (no subject)

2019-05-14 Thread Andriy Andreykiv
branch: c14_complience
commit 0a2bbe34cf4073e35c2f3a587c50e5f6f893ecec
Author: Andriy.Andreykiv 
Date:   Mon May 13 15:50:44 2019 +0200

small correction for Microsoft compiler
---
 src/getfem_mesh_region.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/getfem_mesh_region.cc b/src/getfem_mesh_region.cc
index 4986739..1c8557a 100644
--- a/src/getfem_mesh_region.cc
+++ b/src/getfem_mesh_region.cc
@@ -144,7 +144,7 @@ namespace getfem {
   }
 
   void mesh_region::update_partition_iterators() const{
-if ((partitions_updated == true)) return;
+if ((partitions_updated.thrd_cast() == true)) return;
 itbegin = partition_begin();
 itend = partition_end  ();
 partitions_updated = true;
@@ -237,7 +237,7 @@ namespace getfem {
   const dal::bit_vector&  mesh_region::index() const{
 GMM_ASSERT1(p, "Use from_mesh on that region before");
 if (me_is_multithreaded_now()) {
-  if (!(index_updated == true)){
+  if (!(index_updated.thrd_cast() == true)){
 update_index();
 index_updated = true;
   }



[Getfem-commits] is_only_faces_fix merge request

2019-05-13 Thread Andriy Andreykiv
Dear Yves and Konstantinos,

Kind request to review and merge a small fix in is_only_faces_fix

Best regards,
 Andriy


[Getfem-commits] [getfem-commits] branch is_only_faces_fix created (now 7dbcab9)

2019-05-13 Thread Andriy Andreykiv
andrico pushed a change to branch is_only_faces_fix.

at  7dbcab9   mesh::is_only_faces() fix for region(-1)

This branch includes the following new commits:

   new  7dbcab9   mesh::is_only_faces() fix for region(-1)




[Getfem-commits] (no subject)

2019-04-04 Thread Andriy Andreykiv
branch: upgrade_to_cpp14_consolidated
commit fd7dc6e95054fef8908e2c06f97ab2022ee023ba
Author: aa 
Date:   Thu Apr 4 15:58:23 2019 +0200

1) no more thread static pointer from boost, using thread_static qualifier 
instead
 2) removing "register" keyword, as it's considered deprecated
---
 src/bgeot_geometric_trans.cc   | 10 +--
 src/getfem/bgeot_tensor.h  |  8 +-
 src/getfem/dal_basic.h | 28 +++
 src/getfem/getfem_omp.h| 30 +--
 src/getfem_fem.cc  | 98 +++---
 ...fem_generic_assembly_functions_and_operators.cc | 15 +---
 src/getfem_integration.cc  | 24 +++---
 src/getfem_linearized_plates.cc|  4 +-
 src/getfem_mat_elem.cc |  8 +-
 src/gmm/gmm_domain_decomp.h|  6 +-
 10 files changed, 96 insertions(+), 135 deletions(-)

diff --git a/src/bgeot_geometric_trans.cc b/src/bgeot_geometric_trans.cc
index 0b1cc6a..97a127b 100644
--- a/src/bgeot_geometric_trans.cc
+++ b/src/bgeot_geometric_trans.cc
@@ -29,22 +29,22 @@
 namespace bgeot {
 
   std::vector& __aux1(){
-DEFINE_STATIC_THREAD_LOCAL(std::vector, v);
+THREAD_SAFE_STATIC std::vector v;
 return v;
   }
 
   std::vector& __aux2(){
-DEFINE_STATIC_THREAD_LOCAL(std::vector, v);
+THREAD_SAFE_STATIC std::vector v;
 return v;
   }
 
   std::vector& __aux3(){
-DEFINE_STATIC_THREAD_LOCAL(std::vector, v);
+THREAD_SAFE_STATIC std::vector v;
 return v;
   }
 
   std::vector& __ipvt_aux(){
-DEFINE_STATIC_THREAD_LOCAL(std::vector, vi);
+THREAD_SAFE_STATIC std::vector vi;
 return vi;
   }
 
@@ -279,7 +279,7 @@ namespace bgeot {
 auto itpc_j = pc.begin() + j*P, itG_b = G.begin();
 for (size_type i = 0; i < N; ++i, ++itG_b) {
   auto itG = itG_b, itpc = itpc_j;
-  register scalar_type a = *(itG) * (*itpc);
+  scalar_type a = *(itG) * (*itpc);
   for (size_type k = 1; k < P; ++k)
 { itG += N; a += *(itG) * (*++itpc); }
   *itK++ = a;
diff --git a/src/getfem/bgeot_tensor.h b/src/getfem/bgeot_tensor.h
index 7979157..ebf2671 100644
--- a/src/getfem/bgeot_tensor.h
+++ b/src/getfem/bgeot_tensor.h
@@ -336,8 +336,8 @@ namespace bgeot {
 /* reduction du tenseur t par son indice ni et la matrice  */
 /* transposee de m.*/
 
-DEFINE_STATIC_THREAD_LOCAL(std::vector, tmp);
-DEFINE_STATIC_THREAD_LOCAL(multi_index, mi);
+THREAD_SAFE_STATIC std::vector tmp;
+THREAD_SAFE_STATIC multi_index mi;
 
 mi = t.sizes();
 size_type dimt = mi[ni], dim = m.nrows();
@@ -403,8 +403,8 @@ namespace bgeot {
   template void tensor::mat_reduction
   (const tensor , const gmm::dense_matrix , int ni) {
 /* reduction du tenseur t par son indice ni et la matrice m.   */
-DEFINE_STATIC_THREAD_LOCAL(std::vector, tmp);
-DEFINE_STATIC_THREAD_LOCAL(multi_index, mi);
+THREAD_SAFE_STATIC std::vector tmp;
+THREAD_SAFE_STATIC multi_index mi;
 
 mi = t.sizes();
 size_type dimt = mi[ni], dim = m.ncols();
diff --git a/src/getfem/dal_basic.h b/src/getfem/dal_basic.h
index 878b996..f3acbd5 100644
--- a/src/getfem/dal_basic.h
+++ b/src/getfem/dal_basic.h
@@ -282,7 +282,7 @@ namespace dal
 
   
   /* * */
-  /* Menbers functions*/
+  /* Member functions  */
   /* * */
 
 
@@ -313,9 +313,9 @@ namespace dal
 typename pointer_array::iterator ite = it+ ((last_ind + DNAMPKS__) >> pks);
 while (it != ite) {
   *it = std::unique_ptr(new T[DNAMPKS__+1]);// 
std::make_unique(DNAMPKS__+1);
-  register pointer p = it->get(); ++it;
-  register pointer pe = p + (DNAMPKS__+1);
-  register const_pointer pa = (ita++)->get();
+  pointer p = it->get(); ++it;
+  pointer pe = p + (DNAMPKS__+1);
+  const_pointer pa = (ita++)->get();
   while (p != pe) *p++ = *pa++;
 }
 return *this;
@@ -324,9 +324,8 @@ namespace dal
   template 
 typename dynamic_array::const_reference
   dynamic_array::operator [](size_type ii) const { 
-DEFINE_STATIC_THREAD_LOCAL_INITIALIZED(std::shared_ptr,pf,NULL);
-if (pf.get() == NULL) { pf = std::make_shared(); }
-return (ii>pks])[ii__] : *pf;
+THREAD_SAFE_STATIC T f;
+return (ii>pks])[ii__] : f;
   }
 
   template typename dynamic_array::reference
@@ -336,13 +335,14 @@ namespace dal
   
   last_accessed = ii + 1;
   if (ii >= last_ind) {
-   if ((ii >> (pks+ppks)) > 0) {
- while ((ii >> (pks+ppks)) > 0) ppks++; 
- array.resize(m_ppks = (size_type(1) << ppks)); m_ppks--;
-

[Getfem-commits] (no subject)

2019-04-04 Thread Andriy Andreykiv
branch: upgrade_to_cpp14_consolidated
commit b28f8f6fe45d7dd88b033af77e4b1025eec73441
Author: aa 
Date:   Thu Apr 4 16:01:21 2019 +0200

std::toupper now takes one argument
---
 src/getfem_import.cc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/getfem_import.cc b/src/getfem_import.cc
index ef0fe73..d423f0d 100644
--- a/src/getfem_import.cc
+++ b/src/getfem_import.cc
@@ -788,8 +788,7 @@ namespace getfem {
 type_name = line.substr(pos, pos2-pos);
 bool only_digits
   = (type_name.find_first_not_of("0123456789") == std::string::npos);
-const std::locale loc;
-for (auto&& c : type_name) c = std::toupper(c, loc);
+for (auto&& c : type_name) c = std::toupper(c);
 
 if (elt_types.size() < itype+1)
   elt_types.resize(itype+1);



[Getfem-commits] (no subject)

2019-04-04 Thread Andriy Andreykiv
branch: upgrade_to_cpp14_consolidated
commit b709d375233d7b99c270819df6b0bd7b6feaa3f6
Author: aa 
Date:   Thu Apr 4 16:00:17 2019 +0200

replacing boost with STL or standard language features whenever possible
---
 src/getfem/bgeot_config.h  |  7 ---
 src/getfem/bgeot_kdtree.h  |  6 +-
 src/getfem/dal_static_stored_objects.h | 11 ++-
 src/getfem/getfem_context.h| 10 ++
 src/getfem/getfem_mesh_fem_level_set.h |  5 -
 src/getfem/getfem_partial_mesh_fem.h   |  5 -
 6 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/src/getfem/bgeot_config.h b/src/getfem/bgeot_config.h
index 66a367b..ad951fa 100644
--- a/src/getfem/bgeot_config.h
+++ b/src/getfem/bgeot_config.h
@@ -50,13 +50,6 @@
 #include "gmm/gmm_kernel.h"
 #include "gmm/gmm_dense_lu.h"
 
-#ifdef GETFEM_HAVE_BOOST
-# include 
-# include 
-#else
-# include  
-#endif
-
 #ifdef GETFEM_HAVE_QDLIB
 // #  define NO_INLINE
 #  ifdef GETFEM_QDLIB_USE_QUAD
diff --git a/src/getfem/bgeot_kdtree.h b/src/getfem/bgeot_kdtree.h
index 81c00e9..e347e5a 100644
--- a/src/getfem/bgeot_kdtree.h
+++ b/src/getfem/bgeot_kdtree.h
@@ -100,12 +100,16 @@ namespace bgeot {
   }
   @endcode
   */
-  class kdtree : public boost::noncopyable {
+  class kdtree {
 dim_type N; /* dimension of points */
 std::unique_ptr tree;
 kdtree_tab_type pts;
   public:
 kdtree() : N(0) {}
+
+kdtree(const kdtree&) = delete;
+kdtree  = (const kdtree&) = delete;
+
 /// reset the tree, remove all points
 void clear() { clear_tree(); pts = kdtree_tab_type(); N = 0; }
 void reserve(size_type n) { pts.reserve(n); }
diff --git a/src/getfem/dal_static_stored_objects.h 
b/src/getfem/dal_static_stored_objects.h
index be8ca7e..16814b1 100644
--- a/src/getfem/dal_static_stored_objects.h
+++ b/src/getfem/dal_static_stored_objects.h
@@ -77,14 +77,7 @@ std::shared_ptr are used.
 
 #include "getfem/getfem_arch_config.h"
 
-#ifdef GETFEM_HAS_OPENMP
-  #include 
-  typedef boost::atomic_bool atomic_bool;
-  typedef boost::atomic atomic_int;
-#else
-  typedef int   atomic_int;
-  typedef bool  atomic_bool;
-#endif
+#include 
 
 #define DAL_STORED_OBJECT_DEBUG 0
 
@@ -298,7 +291,7 @@ namespace dal {
   /** Pointer to an object with the dependencies */
   struct enr_static_stored_object {
 pstatic_stored_object p;
-atomic_bool valid;
+std::atomic_bool valid;
 const permanence perm;
 std::set dependent_object;
 std::set dependencies;
diff --git a/src/getfem/getfem_context.h b/src/getfem/getfem_context.h
index e24f4e5..e82017b 100644
--- a/src/getfem/getfem_context.h
+++ b/src/getfem/getfem_context.h
@@ -41,13 +41,7 @@
 #include "getfem_omp.h"
 #include 
 
-#ifdef GETFEM_HAS_OPENMP
-  #include 
-  typedef boost::atomic_bool atomic_bool;
-#else
-  typedef bool  atomic_bool;
-#endif
-
+#include 
 
 namespace getfem {
   /**Deal with interdependencies of objects.
@@ -89,7 +83,7 @@ namespace getfem {
   protected :
 enum context_state { CONTEXT_NORMAL, CONTEXT_CHANGED, CONTEXT_INVALID };
 mutable context_state state;
-mutable atomic_bool touched;
+mutable std::atomic_bool touched;
 mutable std::vector dependencies;
 mutable std::vector dependent;
 typedef std::vector::iterator iterator_list;
diff --git a/src/getfem/getfem_mesh_fem_level_set.h 
b/src/getfem/getfem_mesh_fem_level_set.h
index 81cb4b8..e0e853c 100644
--- a/src/getfem/getfem_mesh_fem_level_set.h
+++ b/src/getfem/getfem_mesh_fem_level_set.h
@@ -45,7 +45,7 @@
 
 namespace getfem {
 
-  class mesh_fem_level_set : public mesh_fem, public boost::noncopyable {
+  class mesh_fem_level_set : public mesh_fem {
   protected :
 const mesh_level_set 
 const mesh_fem 
@@ -72,6 +72,9 @@ namespace getfem {
 
 mesh_fem_level_set(const mesh_level_set , const mesh_fem );
 
+mesh_fem_level_set(const mesh_fem_level_set&) = delete;
+mesh_fem_level_set& operator = (const mesh_fem_level_set&) = delete;
+
 ~mesh_fem_level_set() { clear_build_methods(); }
   };
 
diff --git a/src/getfem/getfem_partial_mesh_fem.h 
b/src/getfem/getfem_partial_mesh_fem.h
index 3ce3411..68230b8 100644
--- a/src/getfem/getfem_partial_mesh_fem.h
+++ b/src/getfem/getfem_partial_mesh_fem.h
@@ -52,7 +52,7 @@ namespace getfem {
  a subclass of mesh_fem which allows to eliminate a number of dof
  of the original mesh_fem.
   */
-  class partial_mesh_fem : public mesh_fem, public boost::noncopyable {
+  class partial_mesh_fem : public mesh_fem {
   protected :
 const mesh_fem 
 mutable bool is_adapted;
@@ -152,6 +152,9 @@ namespace getfem {
 partial_mesh_fem(const mesh_fem );
 partial_mesh_fem(const mesh_fem *mef);
 
+partial_mesh_fem(const partial_mesh_fem&) = delete;
+partial_mesh_fem& operator = (const partial_mesh_fem&) = delete;
+
   };
 
   typedef std::shared_ptr ppartial_mesh_fem;



[Getfem-commits] (no subject)

2019-04-04 Thread Andriy Andreykiv
branch: upgrade_to_cpp14_consolidated
commit 64d2cccbbd2debe0c21e9c849fa543d4b29bfd8c
Author: aa 
Date:   Thu Apr 4 16:00:56 2019 +0200

simplified const box_index * comparison
---
 src/getfem/bgeot_rtree.h | 50 +++-
 1 file changed, 11 insertions(+), 39 deletions(-)

diff --git a/src/getfem/bgeot_rtree.h b/src/getfem/bgeot_rtree.h
index baf7eb2..d26f5f8 100644
--- a/src/getfem/bgeot_rtree.h
+++ b/src/getfem/bgeot_rtree.h
@@ -48,42 +48,10 @@ namespace bgeot {
 base_node min, max;
   };
 
-  /** Wraps "const box_index *" but overloads
-   *  comparison operators based on id and not
-   *  addresses. This ensures deterministic ordering in sets.
-   */
-  struct box_index_ptr {
-box_index_ptr(const box_index *p)
-  : p_{p}
-{}
-
-box_index_ptr(const box_index_ptr&) = default;
-
-bool operator < (const box_index_ptr ) const {
-  return p_->id < bptr.p_->id;
-}
-
-bool operator == (const box_index_ptr ) const {
-  return p_->id == bptr.p_->id;
-}
-
-bool operator != (const box_index_ptr ) const {
-  return !(*this == bptr);
+  struct box_index_compare {
+bool operator()(const box_index *plhs, const box_index *prhs) const {
+  return plhs->id < prhs->id;
 }
-
-operator const box_index *() const {
-  return p_;
-}
-
-const box_index * operator->() const {
-  return p_;
-}
-
-const box_index& operator*() const {
-  return *p_;
-}
-
-const box_index *p_;
   };
 
   struct rtree_elt_base {
@@ -101,11 +69,15 @@ namespace bgeot {
* This is not a dynamic structure. Once a query has been made on the
* tree, new boxes should not be added.
*/
-  class rtree : public boost::noncopyable {
+  class rtree {
   public:
-typedef std::deque box_cont;
-typedef std::vector pbox_cont;
-typedef std::set pbox_set;
+using box_cont = std::deque ;
+using pbox_cont = std::vector;
+using pbox_set = std::set;
+
+rtree() = default;
+rtree(const rtree&) = delete;
+rtree& operator = (const rtree&) = delete;
 
 void add_box(base_node min, base_node max, size_type id=size_type(-1)) {
   box_index bi; bi.min = min; bi.max = max;



[Getfem-commits] (no subject)

2019-04-04 Thread Andriy Andreykiv
branch: making_var_description_copyable
commit b8be815bd553d6443b1c0de10aa2ef38117aff1c
Author: aa 
Date:   Thu Apr 4 15:42:10 2019 +0200

changing constness to allow var_description copying
---
 src/getfem/getfem_models.h | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/getfem/getfem_models.h b/src/getfem/getfem_models.h
index 35c8351..8f9d05c 100644
--- a/src/getfem/getfem_models.h
+++ b/src/getfem/getfem_models.h
@@ -146,28 +146,28 @@ namespace getfem {
 
 struct var_description {
 
-  const bool is_variable;   // This is a variable or a parameter.
+  bool is_variable;   // This is a variable or a parameter.
   bool is_disabled; // For a variable, to be solved or not
-  const bool is_complex;// The variable is complex numbers
+  bool is_complex;// The variable is complex numbers
   bool is_affine_dependent; // The variable depends in an affine way
 // to another variable.
-  const bool is_fem_dofs;   // The variable is the dofs of a fem
+  bool is_fem_dofs;   // The variable is the dofs of a fem
   size_type n_iter; // Number of versions of the variable stored.
   size_type n_temp_iter;// Number of additional temporary versions
   size_type default_iter;   // default iteration number.
 
   ptime_scheme ptsc;// For optional time integration scheme
 
-  const var_description_filter filter; // Version of an optional filter
+  var_description_filter filter; // Version of an optional filter
// on the dofs
-  const size_type filter_region; // Optional region for the filter
-  const std::string filter_var;  // Optional variable name for the filter
-  const mesh_im *filter_mim; // Optional integration method for the 
filter
+  size_type filter_region; // Optional region for the filter
+  std::string filter_var;  // Optional variable name for the filter
+  mesh_im const *filter_mim; // Optional integration method for the 
filter
 
   // fem or im_data description of the variable
-  const mesh_fem *mf;// Main fem of the variable.
+  mesh_fem const *mf;// Main fem of the variable.
   ppartial_mesh_fem partial_mf;  // Filter with respect to mf.
-  const im_data *imd;// im data description
+  im_data const *imd;// im data description
 
   bgeot::multi_index qdims;  // For data having a qdim != of the fem
  // (dim per dof for dof data)
@@ -191,12 +191,12 @@ namespace getfem {
 // dependent variables
 
   var_description(bool is_var = false, bool is_compl = false,
-  const mesh_fem *mf_ = 0, const im_data *imd_ = 0,
+  mesh_fem const *mf_ = 0, im_data const *imd_ = 0,
   size_type n_it = 1,
   var_description_filter filter_ = VDESCRFILTER_NO,
   size_type filter_reg = size_type(-1),
   const std::string _var_ = std::string(""),
-  const mesh_im *filter_mim_ = 0)
+  mesh_im const *filter_mim_ = 0)
 : is_variable(is_var), is_disabled(false), is_complex(is_compl),
   is_affine_dependent(false),
   is_fem_dofs(mf_ != 0),



[Getfem-commits] (no subject)

2019-03-21 Thread Andriy Andreykiv
branch: upgrading_getfem_to_cpp14
commit b93e8190cb6ccbaeea36521503f1e164e2a29274
Author: aa 
Date:   Thu Mar 21 14:58:57 2019 +0100

keyword spelling
---
 src/gmm/gmm_domain_decomp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gmm/gmm_domain_decomp.h b/src/gmm/gmm_domain_decomp.h
index fd787c3..f2a4f69 100644
--- a/src/gmm/gmm_domain_decomp.h
+++ b/src/gmm/gmm_domain_decomp.h
@@ -81,7 +81,7 @@ namespace gmm {
 std::vector ns(dim), na(dim), nu(dim);
 for (size_type i = 0; i < nbpts; ++i) {
   for (int k = 0; k < dim; ++k) {
-  ouble a = (pts[i][k] - pmin[k]) / msize;
+  double a = (pts[i][k] - pmin[k]) / msize;
   ns[k] = size_type(a) - 1; na[k] = 0;
   pts1[k] = int(a + overlap); pts2[k] = int(ceil(a-1.0-overlap));
   }



[Getfem-commits] [getfem-commits] upgrading_getfem_to_cpp14 updated (e7126d9 -> b998578)

2019-03-21 Thread Andriy Andreykiv
andrico pushed a change to branch upgrading_getfem_to_cpp14.

  from  e7126d9   Merge branch 'master' of git.sv.gnu.org:/srv/git/getfem 
into upgrading_getfem_to_cpp14
   new  b93e819   keyword spelling
   new  b998578   no need for a smart pointer here. Value semantics will do.


Summary of changes:
 src/getfem/dal_basic.h  | 22 +++---
 src/gmm/gmm_domain_decomp.h |  2 +-
 2 files changed, 12 insertions(+), 12 deletions(-)



[Getfem-commits] (no subject)

2019-03-21 Thread Andriy Andreykiv
branch: upgrading_getfem_to_cpp14
commit cefabdb823513a0221d1468f76f6363cc3360929
Author: aa 
Date:   Mon Mar 18 14:50:00 2019 +0100

returning the fix that disappeared after the merge
---
 src/getfem_generic_assembly_workspace.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/getfem_generic_assembly_workspace.cc 
b/src/getfem_generic_assembly_workspace.cc
index 9d95991..2e66c16 100644
--- a/src/getfem_generic_assembly_workspace.cc
+++ b/src/getfem_generic_assembly_workspace.cc
@@ -606,7 +606,7 @@ namespace getfem {
 if (tree.root) {
   GMM_ASSERT1(tree.root->nb_test_functions() == 0,
   "Invalid expression containing test functions");
-  add_tree(tree, m, mim, rg, expr, order+1, false,
+  add_tree(tree, m, mim, rg, expr, order, false,
before ? ga_workspace::PRE_ASSIGNMENT
   : ga_workspace::POST_ASSIGNMENT,
varname);



[Getfem-commits] (no subject)

2019-03-21 Thread Andriy Andreykiv
branch: upgrading_getfem_to_cpp14
commit e7126d980fd9e8585054cdfcdcb15520e65d95b9
Merge: cefabdb 30d3f39
Author: aa 
Date:   Thu Mar 21 14:30:39 2019 +0100

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




[Getfem-commits] [getfem-commits] upgrading_getfem_to_cpp14 updated (8f8b8a2 -> e7126d9)

2019-03-21 Thread Andriy Andreykiv
andrico pushed a change to branch upgrading_getfem_to_cpp14.

  from  8f8b8a2   Merge branch 'debug_assembly_breakage' of 
git.sv.gnu.org:/srv/git/getfem into upgrading_getfem_to_cpp14
   new  cefabdb   returning the fix that disappeared after the merge
  adds  30d3f39   Fix regression in assembly with assignment expressions
   new  e7126d9   Merge branch 'master' of git.sv.gnu.org:/srv/git/getfem 
into upgrading_getfem_to_cpp14


Summary of changes:
 src/getfem_generic_assembly_workspace.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[Getfem-commits] (no subject)

2019-03-18 Thread Andriy Andreykiv
branch: upgrading_getfem_to_cpp14
commit 8f8b8a22ec0b5e168d9de284cf2709908055de45
Merge: cead721 c39b1d5
Author: aa 
Date:   Mon Mar 18 12:42:16 2019 +0100

Merge branch 'debug_assembly_breakage' of git.sv.gnu.org:/srv/git/getfem 
into upgrading_getfem_to_cpp14

# Conflicts:
#   src/getfem/bgeot_rtree.h
#   src/getfem/getfem_generic_assembly.h




[Getfem-commits] [getfem-commits] upgrading_getfem_to_cpp14 updated (cead721 -> 8f8b8a2)

2019-03-18 Thread Andriy Andreykiv
andrico pushed a change to branch upgrading_getfem_to_cpp14.

  from  cead721   more concise comparison
  adds  8392e34   Revert 1
  adds  be317eb   Revert 2
  adds  31d449d   Revert 3
  adds  70beae9   re-introducing the same changes as in the latest commits 
in the master, to be able to compile
  adds  c39b1d5   Fix 1
   new  8f8b8a2   Merge branch 'debug_assembly_breakage' of 
git.sv.gnu.org:/srv/git/getfem into upgrading_getfem_to_cpp14


Summary of changes:



[Getfem-commits] [getfem-commits] upgrading_getfem_to_cpp14 updated (776b81d -> cead721)

2019-03-18 Thread Andriy Andreykiv
andrico pushed a change to branch upgrading_getfem_to_cpp14.

  from  776b81d   c++14 as a default compilation standard
  adds  4487cec   two small fixes
  adds  9961a1c   Add struct lumped_mass_brick_for_first_order
  adds  4b53edb   Merge branch 'master' of 
ssh://git.sv.gnu.org:/srv/git/getfem into devel-tetsuo-model_lumped_mass_matrix
  adds  7d37202   Merge branch 'master' of 
ssh://git.sv.gnu.org:/srv/git/getfem into devel-tetsuo-model_lumped_mass_matrix
  adds  6fbdde8   add add_lumped_mass_brick_for_first_order function
  adds  0254182   Merge branch 'master' of 
ssh://git.sv.gnu.org:/srv/git/getfem into devel-tetsuo-model_lumped_mass_matrix
  adds  d45f136   Fix bug introduced in #69583e8b
  adds  21c9098   Type naming simplifications
  adds  f374fd7   Whitespace, typos, file encodings
  adds  05f69a3   Code simplifications and whitespace
  adds  bf68273   Code simplifications
  adds  65084ce   Move model_pb class from header to implementation file 
and remove scale_residual() function
  adds  2d8cea5   Small extension of bgeot::tensor constructors
  adds  cd0c759   Coding style changes and simplifications
  adds  fe2a357   Simplify disable_variable and enable_variable
  adds  81b9911   update: code-cleanup
  adds  aaddb20   Merge branch 'master' of 
ssh://git.sv.gnu.org:/srv/git/getfem into devel-tetsuo-code-cleanup
  adds  65ebcac   Merge branch 'devel-tetsuo-code-cleanup' of 
ssh://git.sv.gnu.org:/srv/git/getfem into devel-tetsuo-code-cleanup
  adds  982ccbd   Merge remote-tracking branch 
'origin/devel-tetsuo-code-cleanup'
  adds  290b604   Interface simplification
  adds  dffc8b5   Merge branch 'master' of 
ssh://git.sv.gnu.org:/srv/git/getfem
  adds  2f7396a   Code cleanup and stricter constness
  adds  69f08ef   Delete ambiguous constructor for tensors
  adds  ccb9a29   Code clean up, renamings, stricter constness
  adds  4b8f2d9   enforcing deterministic order of boxes in an R-tree by 
introducing a pointer wrapper that compared the boxes based on id and not the 
address.
  adds  088b72c   hiding fallthrough
  adds  00ddea3   returning model_pb to the header as it's being used 
elsewhere
   new  0213e2d   Merge branch 'master' of git.sv.gnu.org:/srv/git/getfem 
into upgrading_getfem_to_cpp14
   new  cead721   more concise comparison


Summary of changes:
 interface/src/gf_asm.cc|  80 +--
 src/getfem/bgeot_mesh.h|   4 +-
 src/getfem/bgeot_mesh_structure.h  |   6 +-
 src/getfem/bgeot_rtree.h   |  16 +-
 src/getfem/bgeot_tensor.h  |  25 +-
 src/getfem/getfem_assembling.h |   8 +-
 src/getfem/getfem_deformable_mesh.h|   2 +-
 src/getfem/getfem_generic_assembly.h   |  78 ++-
 .../getfem_generic_assembly_compile_and_exec.h |  35 +-
 src/getfem/getfem_generic_assembly_semantic.h  |  34 +-
 src/getfem/getfem_generic_assembly_tree.h  |  16 +-
 src/getfem/getfem_mesh_fem.h   |   8 +-
 src/getfem/getfem_model_solvers.h  | 272 +-
 src/getfem/getfem_models.h | 114 +++--
 src/getfem/getfem_partial_mesh_fem.h   |   2 +-
 src/getfem_contact_and_friction_common.cc  |   6 +-
 src/getfem_generic_assembly_compile_and_exec.cc| 387 +++---
 src/getfem_generic_assembly_interpolation.cc   |  34 +-
 src/getfem_generic_assembly_semantic.cc|  11 +-
 src/getfem_generic_assembly_tree.cc|   2 +-
 src/getfem_generic_assembly_workspace.cc   | 192 ---
 src/getfem_mesh.cc |   2 +-
 src/getfem_model_solvers.cc|  25 +-
 src/getfem_models.cc   | 426 ---
 src/getfem_plasticity.cc   |   7 +-
 src/gmm/gmm_matrix.h   | 330 ++--
 src/gmm/gmm_vector.h   | 570 ++---
 27 files changed, 1356 insertions(+), 1336 deletions(-)



[Getfem-commits] (no subject)

2019-03-18 Thread Andriy Andreykiv
branch: upgrading_getfem_to_cpp14
commit 0213e2dc50e0a20f0c032c0820f5ca3b276acd1c
Merge: 776b81d 00ddea3
Author: aa 
Date:   Fri Mar 15 11:01:31 2019 +0100

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

 interface/src/gf_asm.cc|  80 +--
 src/getfem/bgeot_mesh.h|   4 +-
 src/getfem/bgeot_mesh_structure.h  |   6 +-
 src/getfem/bgeot_rtree.h   |  44 +-
 src/getfem/bgeot_tensor.h  |  25 +-
 src/getfem/getfem_assembling.h |   8 +-
 src/getfem/getfem_deformable_mesh.h|   2 +-
 src/getfem/getfem_generic_assembly.h   |  78 ++-
 .../getfem_generic_assembly_compile_and_exec.h |  35 +-
 src/getfem/getfem_generic_assembly_semantic.h  |  34 +-
 src/getfem/getfem_generic_assembly_tree.h  |  16 +-
 src/getfem/getfem_mesh_fem.h   |   8 +-
 src/getfem/getfem_model_solvers.h  | 272 +-
 src/getfem/getfem_models.h | 114 +++--
 src/getfem/getfem_partial_mesh_fem.h   |   2 +-
 src/getfem_contact_and_friction_common.cc  |   6 +-
 src/getfem_generic_assembly_compile_and_exec.cc| 387 +++---
 src/getfem_generic_assembly_interpolation.cc   |  34 +-
 src/getfem_generic_assembly_semantic.cc|  11 +-
 src/getfem_generic_assembly_tree.cc|   2 +-
 src/getfem_generic_assembly_workspace.cc   | 192 ---
 src/getfem_mesh.cc |   2 +-
 src/getfem_model_solvers.cc|  25 +-
 src/getfem_models.cc   | 426 ---
 src/getfem_plasticity.cc   |   7 +-
 src/gmm/gmm_matrix.h   | 330 ++--
 src/gmm/gmm_vector.h   | 570 ++---
 27 files changed, 1386 insertions(+), 1334 deletions(-)

diff --cc src/getfem/bgeot_rtree.h
index d4c4ee2,baf7eb2..630d030
--- a/src/getfem/bgeot_rtree.h
+++ b/src/getfem/bgeot_rtree.h
@@@ -67,12 -105,8 +105,12 @@@ namespace bgeot 
public:
  typedef std::deque box_cont;
  typedef std::vector pbox_cont;
- typedef std::set pbox_set;
+ typedef std::set pbox_set;
  
 +rtree() = default;
 +rtree(const rtree&) = delete;
 +rtree& operator = (const rtree&) = delete;
 +
  void add_box(base_node min, base_node max, size_type id=size_type(-1)) {
box_index bi; bi.min = min; bi.max = max;
bi.id = (id + 1) ? id : boxes.size();



[Getfem-commits] (no subject)

2019-03-18 Thread Andriy Andreykiv
branch: upgrading_getfem_to_cpp14
commit cead721abe2c3fa0ebbf32654e8df732e01fce6e
Author: aa 
Date:   Mon Mar 18 11:54:14 2019 +0100

more concise comparison
---
 src/getfem/bgeot_rtree.h | 44 ++--
 1 file changed, 6 insertions(+), 38 deletions(-)

diff --git a/src/getfem/bgeot_rtree.h b/src/getfem/bgeot_rtree.h
index 630d030..d26f5f8 100644
--- a/src/getfem/bgeot_rtree.h
+++ b/src/getfem/bgeot_rtree.h
@@ -48,42 +48,10 @@ namespace bgeot {
 base_node min, max;
   };
 
-  /** Wraps "const box_index *" but overloads
-   *  comparison operators based on id and not
-   *  addresses. This ensures deterministic ordering in sets.
-   */
-  struct box_index_ptr {
-box_index_ptr(const box_index *p)
-  : p_{p}
-{}
-
-box_index_ptr(const box_index_ptr&) = default;
-
-bool operator < (const box_index_ptr ) const {
-  return p_->id < bptr.p_->id;
-}
-
-bool operator == (const box_index_ptr ) const {
-  return p_->id == bptr.p_->id;
-}
-
-bool operator != (const box_index_ptr ) const {
-  return !(*this == bptr);
+  struct box_index_compare {
+bool operator()(const box_index *plhs, const box_index *prhs) const {
+  return plhs->id < prhs->id;
 }
-
-operator const box_index *() const {
-  return p_;
-}
-
-const box_index * operator->() const {
-  return p_;
-}
-
-const box_index& operator*() const {
-  return *p_;
-}
-
-const box_index *p_;
   };
 
   struct rtree_elt_base {
@@ -103,9 +71,9 @@ namespace bgeot {
*/
   class rtree {
   public:
-typedef std::deque box_cont;
-typedef std::vector pbox_cont;
-typedef std::set pbox_set;
+using box_cont = std::deque ;
+using pbox_cont = std::vector;
+using pbox_set = std::set;
 
 rtree() = default;
 rtree(const rtree&) = delete;



[Getfem-commits] [getfem-commits] debug_assembly_breakage updated (31d449d -> 70beae9)

2019-03-14 Thread Andriy Andreykiv
andrico pushed a change to branch debug_assembly_breakage.

  from  31d449d   Revert 3
   new  70beae9   re-introducing the same changes as in the latest commits 
in the master, to be able to compile


Summary of changes:
 src/getfem/bgeot_rtree.h|  44 +++-
 src/getfem/getfem_model_solvers.h   | 115 +++
 src/getfem_generic_assembly_semantic.cc |  10 +--
 src/getfem_model_solvers.cc | 116 
 4 files changed, 161 insertions(+), 124 deletions(-)



[Getfem-commits] [getfem-commits] branch before_assembly_failure created (now 05030d5)

2019-03-13 Thread Andriy Andreykiv
andrico pushed a change to branch before_assembly_failure.

at  05030d5   everting 2f7396a46dadad266ba882623d300d1a19e274dc and 
ccb9a29bed98470d88ef896976b38e6eab147b07 that break assembly and re-introducing 
again the commits that follow

This branch includes the following new commits:

   new  05030d5   everting 2f7396a46dadad266ba882623d300d1a19e274dc and 
ccb9a29bed98470d88ef896976b38e6eab147b07 that break assembly and re-introducing 
again the commits that follow




[Getfem-commits] (no subject)

2019-03-13 Thread Andriy Andreykiv
branch: before_assembly_failure
commit 05030d5457b573a31257fb7f1fad89b72277f2da
Author: Andriy.Andreykiv 
Date:   Wed Mar 13 11:24:48 2019 +0100

everting 2f7396a46dadad266ba882623d300d1a19e274dc and 
ccb9a29bed98470d88ef896976b38e6eab147b07
that break assembly and re-introducing again the commits that follow
---
 src/getfem/bgeot_rtree.h|  44 +++-
 src/getfem/bgeot_tensor.h   |  17 +++--
 src/getfem/getfem_model_solvers.h   | 115 +++
 src/getfem_generic_assembly_semantic.cc |   8 +--
 src/getfem_model_solvers.cc | 116 
 5 files changed, 168 insertions(+), 132 deletions(-)

diff --git a/src/getfem/bgeot_rtree.h b/src/getfem/bgeot_rtree.h
index 397eec3..892d3b6 100644
--- a/src/getfem/bgeot_rtree.h
+++ b/src/getfem/bgeot_rtree.h
@@ -47,13 +47,51 @@ namespace bgeot {
 size_type id;
 base_node min, max;
   };
- 
+
+  /** Wraps "const box_index *" but overloads
+   *  comparison operators based on id and not
+   *  addresses. This ensures deterministic ordering in sets.
+   */
+  struct box_index_ptr {
+box_index_ptr(const box_index *p)
+  : p_{p}
+{}
+
+box_index_ptr(const box_index_ptr&) = default;
+
+inline bool operator < (const box_index_ptr ) const {
+  return p_->id < bptr.p_->id;
+}
+
+inline bool operator == (const box_index_ptr ) const {
+  return p_->id == bptr.p_->id;
+}
+
+inline bool operator != (const box_index_ptr ) const {
+  return !(*this == bptr);
+}
+
+inline operator const box_index *() const {
+  return p_;
+}
+
+inline const box_index * operator->() const {
+  return p_;
+}
+
+inline const box_index& operator*() const {
+  return *p_;
+}
+
+const box_index *p_;
+  };
+
   struct rtree_elt_base {
 enum { RECTS_PER_LEAF=8 };
 bool isleaf_;
 bool isleaf() const { return isleaf_; }
 base_node rmin, rmax;
-rtree_elt_base(bool leaf, const base_node& rmin_, const base_node& rmax_) 
+rtree_elt_base(bool leaf, const base_node& rmin_, const base_node& rmax_)
   : isleaf_(leaf), rmin(rmin_), rmax(rmax_) {}
 virtual ~rtree_elt_base() {}
   };
@@ -67,7 +105,7 @@ namespace bgeot {
   public:
 typedef std::deque box_cont;
 typedef std::vector pbox_cont;
-typedef std::set pbox_set;
+typedef std::set pbox_set;
 
 void add_box(base_node min, base_node max, size_type id=size_type(-1)) {
   box_index bi; bi.min = min; bi.max = max;
diff --git a/src/getfem/bgeot_tensor.h b/src/getfem/bgeot_tensor.h
index 815f6eb..2629a79 100644
--- a/src/getfem/bgeot_tensor.h
+++ b/src/getfem/bgeot_tensor.h
@@ -222,14 +222,14 @@ namespace bgeot {
 }
 
 inline void init(size_type i, size_type j, size_type k) {
-  sizes_.resize(3); sizes_[0] = i; sizes_[1] = j; sizes_[2] = k; 
+  sizes_.resize(3); sizes_[0] = i; sizes_[1] = j; sizes_[2] = k;
   coeff.resize(3); coeff[0] = 1; coeff[1] = i; coeff[2] = i*j;
   this->resize(i*j*k);
 }
 
 inline void init(size_type i, size_type j, size_type k, size_type l) {
   sizes_.resize(4);
-  sizes_[0] = i; sizes_[1] = j; sizes_[2] = k; sizes_[3] = k; 
+  sizes_[0] = i; sizes_[1] = j; sizes_[2] = k; sizes_[3] = k;
   coeff.resize(4);
   coeff[0] = 1; coeff[1] = i; coeff[2] = i*j; coeff[3] = i*j*k;
   this->resize(i*j*k*l);
@@ -243,7 +243,7 @@ namespace bgeot {
 { init(i, j, k); }
 inline void adjust_sizes(size_type i, size_type j, size_type k, size_type 
l)
 { init(i, j, k, l); }
-
+
 inline size_type adjust_sizes_changing_last(const tensor , size_type P) {
   const multi_index  = t.sizes_; size_type d = mi.size();
   sizes_.resize(d); coeff.resize(d);
@@ -323,12 +323,11 @@ namespace bgeot {
 }
 
 tensor(const multi_index ) { init(c); }
-tensor(size_type i, size_type j)
-{ init(multi_index(i, j)); }
-tensor(size_type i, size_type j, size_type k)
-{ init(multi_index(i, j, k)); }
+tensor(size_type i) = delete; // { init(i); }
+tensor(size_type i, size_type j)  { init(i, j); }
+tensor(size_type i, size_type j, size_type k) { init(i, j, k); }
 tensor(size_type i, size_type j, size_type k, size_type l)
-{ init(multi_index(i, j, k, l)); }
+{ init(i, j, k, l); }
 tensor() {}
   };
 
@@ -406,7 +405,7 @@ namespace bgeot {
 /* reduction du tenseur t par son indice ni et la matrice m.   */
 DEFINE_STATIC_THREAD_LOCAL(std::vector, tmp);
 DEFINE_STATIC_THREAD_LOCAL(multi_index, mi);
-
+
 mi = t.sizes();
 size_type dimt = mi[ni], dim = m.ncols();
 GMM_ASSERT2(dimt, "Inconsistent dimension.");
diff --git a/src/getfem/getfem_model_solvers.h 
b/src/getfem/getfem_model_solvers.h
index 6f1d8d4..6280bd2 100644
--- a/src/getfem/getfem_model_solvers.h
+++ b/src/getfem/getfem_model_solvers.h
@@ -719,6 +719,121 @@ namespace getfem {
 return select_linear_solver(md, name);
   

[Getfem-commits] [getfem-commits] consistent_rtree_box_order updated (088b72c -> 00ddea3)

2019-03-08 Thread Andriy Andreykiv
andrico pushed a change to branch consistent_rtree_box_order.

  from  088b72c   hiding fallthrough
   new  00ddea3   returning model_pb to the header as it's being used 
elsewhere


Summary of changes:
 src/getfem/getfem_model_solvers.h | 115 +
 src/getfem_model_solvers.cc   | 116 --
 2 files changed, 115 insertions(+), 116 deletions(-)



[Getfem-commits] [getfem-commits] consistent_rtree_box_order updated (4b8f2d9 -> 088b72c)

2019-03-08 Thread Andriy Andreykiv
andrico pushed a change to branch consistent_rtree_box_order.

  from  4b8f2d9   enforcing deterministic order of boxes in an R-tree by 
introducing a pointer wrapper that compared the boxes based on id and not the 
address.
   new  088b72c   hiding fallthrough


Summary of changes:
 src/getfem_generic_assembly_semantic.cc | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)



[Getfem-commits] consistent_rtree_box_order merge request

2019-03-08 Thread Andriy Andreykiv
Dear Yves and Konstantinous,

Kind request to review and  merge consistent_rtree_box_order branch.
The motivation for the branch is to ensure a deterministic ordering of
boxes in R-Trees, so that
they are ordered by id and not the address, as the later is not
deterministic.
(leads to weird cases sometimes).

Thank you in advance,
  Andriy


[Getfem-commits] [getfem-commits] branch consistent_rtree_box_order created (now 4b8f2d9)

2019-03-08 Thread Andriy Andreykiv
andrico pushed a change to branch consistent_rtree_box_order.

at  4b8f2d9   enforcing deterministic order of boxes in an R-tree by 
introducing a pointer wrapper that compared the boxes based on id and not the 
address.

This branch includes the following new commits:

   new  4b8f2d9   enforcing deterministic order of boxes in an R-tree by 
introducing a pointer wrapper that compared the boxes based on id and not the 
address.




[Getfem-commits] (no subject)

2019-03-08 Thread Andriy Andreykiv
branch: consistent_rtree_box_order
commit 4b8f2d96a536ec11eab6b01d06d185797810f4ae
Author: Andriy.Andreykiv 
Date:   Fri Mar 8 13:57:02 2019 +0100

enforcing deterministic order of boxes in an R-tree by introducing a 
pointer wrapper that compared the boxes based on id and not the address.
---
 src/getfem/bgeot_rtree.h | 44 +---
 1 file changed, 41 insertions(+), 3 deletions(-)

diff --git a/src/getfem/bgeot_rtree.h b/src/getfem/bgeot_rtree.h
index 397eec3..baf7eb2 100644
--- a/src/getfem/bgeot_rtree.h
+++ b/src/getfem/bgeot_rtree.h
@@ -47,13 +47,51 @@ namespace bgeot {
 size_type id;
 base_node min, max;
   };
- 
+
+  /** Wraps "const box_index *" but overloads
+   *  comparison operators based on id and not
+   *  addresses. This ensures deterministic ordering in sets.
+   */
+  struct box_index_ptr {
+box_index_ptr(const box_index *p)
+  : p_{p}
+{}
+
+box_index_ptr(const box_index_ptr&) = default;
+
+bool operator < (const box_index_ptr ) const {
+  return p_->id < bptr.p_->id;
+}
+
+bool operator == (const box_index_ptr ) const {
+  return p_->id == bptr.p_->id;
+}
+
+bool operator != (const box_index_ptr ) const {
+  return !(*this == bptr);
+}
+
+operator const box_index *() const {
+  return p_;
+}
+
+const box_index * operator->() const {
+  return p_;
+}
+
+const box_index& operator*() const {
+  return *p_;
+}
+
+const box_index *p_;
+  };
+
   struct rtree_elt_base {
 enum { RECTS_PER_LEAF=8 };
 bool isleaf_;
 bool isleaf() const { return isleaf_; }
 base_node rmin, rmax;
-rtree_elt_base(bool leaf, const base_node& rmin_, const base_node& rmax_) 
+rtree_elt_base(bool leaf, const base_node& rmin_, const base_node& rmax_)
   : isleaf_(leaf), rmin(rmin_), rmax(rmax_) {}
 virtual ~rtree_elt_base() {}
   };
@@ -67,7 +105,7 @@ namespace bgeot {
   public:
 typedef std::deque box_cont;
 typedef std::vector pbox_cont;
-typedef std::set pbox_set;
+typedef std::set pbox_set;
 
 void add_box(base_node min, base_node max, size_type id=size_type(-1)) {
   box_index bi; bi.min = min; bi.max = max;



[Getfem-commits] (no subject)

2019-02-18 Thread Andriy Andreykiv
branch: upgrading_getfem_to_cpp14
commit 8a7adc6bfe3a3636b06bc380b51a180f4d5d3db5
Author: aa 
Date:   Mon Feb 18 15:53:11 2019 +0100

further eradication of boost
---
 src/getfem/bgeot_config.h  | 7 ---
 src/getfem/bgeot_kdtree.h  | 6 +-
 src/getfem/bgeot_rtree.h   | 6 +-
 src/getfem/getfem_mesh_fem_level_set.h | 5 -
 src/getfem/getfem_partial_mesh_fem.h   | 5 -
 5 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/getfem/bgeot_config.h b/src/getfem/bgeot_config.h
index 66a367b..ad951fa 100644
--- a/src/getfem/bgeot_config.h
+++ b/src/getfem/bgeot_config.h
@@ -50,13 +50,6 @@
 #include "gmm/gmm_kernel.h"
 #include "gmm/gmm_dense_lu.h"
 
-#ifdef GETFEM_HAVE_BOOST
-# include 
-# include 
-#else
-# include  
-#endif
-
 #ifdef GETFEM_HAVE_QDLIB
 // #  define NO_INLINE
 #  ifdef GETFEM_QDLIB_USE_QUAD
diff --git a/src/getfem/bgeot_kdtree.h b/src/getfem/bgeot_kdtree.h
index 81c00e9..e347e5a 100644
--- a/src/getfem/bgeot_kdtree.h
+++ b/src/getfem/bgeot_kdtree.h
@@ -100,12 +100,16 @@ namespace bgeot {
   }
   @endcode
   */
-  class kdtree : public boost::noncopyable {
+  class kdtree {
 dim_type N; /* dimension of points */
 std::unique_ptr tree;
 kdtree_tab_type pts;
   public:
 kdtree() : N(0) {}
+
+kdtree(const kdtree&) = delete;
+kdtree  = (const kdtree&) = delete;
+
 /// reset the tree, remove all points
 void clear() { clear_tree(); pts = kdtree_tab_type(); N = 0; }
 void reserve(size_type n) { pts.reserve(n); }
diff --git a/src/getfem/bgeot_rtree.h b/src/getfem/bgeot_rtree.h
index 397eec3..d4c4ee2 100644
--- a/src/getfem/bgeot_rtree.h
+++ b/src/getfem/bgeot_rtree.h
@@ -63,12 +63,16 @@ namespace bgeot {
* This is not a dynamic structure. Once a query has been made on the
* tree, new boxes should not be added.
*/
-  class rtree : public boost::noncopyable {
+  class rtree {
   public:
 typedef std::deque box_cont;
 typedef std::vector pbox_cont;
 typedef std::set pbox_set;
 
+rtree() = default;
+rtree(const rtree&) = delete;
+rtree& operator = (const rtree&) = delete;
+
 void add_box(base_node min, base_node max, size_type id=size_type(-1)) {
   box_index bi; bi.min = min; bi.max = max;
   bi.id = (id + 1) ? id : boxes.size();
diff --git a/src/getfem/getfem_mesh_fem_level_set.h 
b/src/getfem/getfem_mesh_fem_level_set.h
index 81cb4b8..e0e853c 100644
--- a/src/getfem/getfem_mesh_fem_level_set.h
+++ b/src/getfem/getfem_mesh_fem_level_set.h
@@ -45,7 +45,7 @@
 
 namespace getfem {
 
-  class mesh_fem_level_set : public mesh_fem, public boost::noncopyable {
+  class mesh_fem_level_set : public mesh_fem {
   protected :
 const mesh_level_set 
 const mesh_fem 
@@ -72,6 +72,9 @@ namespace getfem {
 
 mesh_fem_level_set(const mesh_level_set , const mesh_fem );
 
+mesh_fem_level_set(const mesh_fem_level_set&) = delete;
+mesh_fem_level_set& operator = (const mesh_fem_level_set&) = delete;
+
 ~mesh_fem_level_set() { clear_build_methods(); }
   };
 
diff --git a/src/getfem/getfem_partial_mesh_fem.h 
b/src/getfem/getfem_partial_mesh_fem.h
index b6bd00d..30ee394 100644
--- a/src/getfem/getfem_partial_mesh_fem.h
+++ b/src/getfem/getfem_partial_mesh_fem.h
@@ -52,7 +52,7 @@ namespace getfem {
  a subclass of mesh_fem which allows to eliminate a number of dof
  of the original mesh_fem.
   */
-  class partial_mesh_fem : public mesh_fem, public boost::noncopyable {
+  class partial_mesh_fem : public mesh_fem {
   protected :
 const mesh_fem 
 mutable bool is_adapted;
@@ -152,6 +152,9 @@ namespace getfem {
 partial_mesh_fem(const mesh_fem );
 partial_mesh_fem(const mesh_fem *mef);
 
+partial_mesh_fem(const partial_mesh_fem&) = delete;
+partial_mesh_fem& operator = (const partial_mesh_fem&) = delete;
+
   };
 
   typedef std::shared_ptr ppartial_mesh_fem;



[Getfem-commits] (no subject)

2019-02-18 Thread Andriy Andreykiv
branch: upgrading_getfem_to_cpp14
commit 0325c78f00dd6c917d8db20c21428c1e9752256e
Author: aa 
Date:   Mon Feb 18 15:59:54 2019 +0100

c-style keyword register is depreciated in the latest standards of C++
---
 src/bgeot_geometric_trans.cc | 2 +-
 src/getfem/dal_basic.h   | 6 +++---
 src/gmm/gmm_domain_decomp.h  | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/bgeot_geometric_trans.cc b/src/bgeot_geometric_trans.cc
index 7e89d4f..97a127b 100644
--- a/src/bgeot_geometric_trans.cc
+++ b/src/bgeot_geometric_trans.cc
@@ -279,7 +279,7 @@ namespace bgeot {
 auto itpc_j = pc.begin() + j*P, itG_b = G.begin();
 for (size_type i = 0; i < N; ++i, ++itG_b) {
   auto itG = itG_b, itpc = itpc_j;
-  register scalar_type a = *(itG) * (*itpc);
+  scalar_type a = *(itG) * (*itpc);
   for (size_type k = 1; k < P; ++k)
 { itG += N; a += *(itG) * (*++itpc); }
   *itK++ = a;
diff --git a/src/getfem/dal_basic.h b/src/getfem/dal_basic.h
index 932ca72..4a6a19a 100644
--- a/src/getfem/dal_basic.h
+++ b/src/getfem/dal_basic.h
@@ -313,9 +313,9 @@ namespace dal
 typename pointer_array::iterator ite = it+ ((last_ind + DNAMPKS__) >> pks);
 while (it != ite) {
   *it = std::unique_ptr(new T[DNAMPKS__+1]);// 
std::make_unique(DNAMPKS__+1);
-  register pointer p = it->get(); ++it;
-  register pointer pe = p + (DNAMPKS__+1);
-  register const_pointer pa = (ita++)->get();
+  pointer p = it->get(); ++it;
+  pointer pe = p + (DNAMPKS__+1);
+  const_pointer pa = (ita++)->get();
   while (p != pe) *p++ = *pa++;
 }
 return *this;
diff --git a/src/gmm/gmm_domain_decomp.h b/src/gmm/gmm_domain_decomp.h
index 2821f3a..fd787c3 100644
--- a/src/gmm/gmm_domain_decomp.h
+++ b/src/gmm/gmm_domain_decomp.h
@@ -81,9 +81,9 @@ namespace gmm {
 std::vector ns(dim), na(dim), nu(dim);
 for (size_type i = 0; i < nbpts; ++i) {
   for (int k = 0; k < dim; ++k) {
-   register double a = (pts[i][k] - pmin[k]) / msize;
-   ns[k] = size_type(a) - 1; na[k] = 0;
-   pts1[k] = int(a + overlap); pts2[k] = int(ceil(a-1.0-overlap));
+  ouble a = (pts[i][k] - pmin[k]) / msize;
+  ns[k] = size_type(a) - 1; na[k] = 0;
+  pts1[k] = int(a + overlap); pts2[k] = int(ceil(a-1.0-overlap));
   }
   size_type sum = 0;
   do {



[Getfem-commits] (no subject)

2019-02-18 Thread Andriy Andreykiv
branch: upgrading_getfem_to_cpp14
commit 701030ad2b8417e02172cc468b36d4ae50fcbebd
Author: aa 
Date:   Mon Feb 18 15:37:46 2019 +0100

replacing boost::thread_specific_ptr with thread_local via a macro
---
 src/bgeot_geometric_trans.cc|  8 ++--
 src/getfem/bgeot_tensor.h   |  8 ++--
 src/getfem/dal_basic.h  |  4 +-
 src/getfem/getfem_omp.h | 30 +
 src/getfem_fem.cc   | 98 -
 src/getfem_integration.cc   | 24 +-
 src/getfem_linearized_plates.cc |  4 +-
 src/getfem_mat_elem.cc  |  8 ++--
 8 files changed, 79 insertions(+), 105 deletions(-)

diff --git a/src/bgeot_geometric_trans.cc b/src/bgeot_geometric_trans.cc
index 0b1cc6a..7e89d4f 100644
--- a/src/bgeot_geometric_trans.cc
+++ b/src/bgeot_geometric_trans.cc
@@ -29,22 +29,22 @@
 namespace bgeot {
 
   std::vector& __aux1(){
-DEFINE_STATIC_THREAD_LOCAL(std::vector, v);
+THREAD_SAFE_STATIC std::vector v;
 return v;
   }
 
   std::vector& __aux2(){
-DEFINE_STATIC_THREAD_LOCAL(std::vector, v);
+THREAD_SAFE_STATIC std::vector v;
 return v;
   }
 
   std::vector& __aux3(){
-DEFINE_STATIC_THREAD_LOCAL(std::vector, v);
+THREAD_SAFE_STATIC std::vector v;
 return v;
   }
 
   std::vector& __ipvt_aux(){
-DEFINE_STATIC_THREAD_LOCAL(std::vector, vi);
+THREAD_SAFE_STATIC std::vector vi;
 return vi;
   }
 
diff --git a/src/getfem/bgeot_tensor.h b/src/getfem/bgeot_tensor.h
index 43d779d..b155d2b 100644
--- a/src/getfem/bgeot_tensor.h
+++ b/src/getfem/bgeot_tensor.h
@@ -333,8 +333,8 @@ namespace bgeot {
 /* reduction du tenseur t par son indice ni et la matrice  */
 /* transposee de m.*/
 
-DEFINE_STATIC_THREAD_LOCAL(std::vector, tmp);
-DEFINE_STATIC_THREAD_LOCAL(multi_index, mi);
+THREAD_SAFE_STATIC std::vector tmp;
+THREAD_SAFE_STATIC multi_index mi;
 
 mi = t.sizes();
 size_type dimt = mi[ni], dim = m.nrows();
@@ -400,8 +400,8 @@ namespace bgeot {
   template void tensor::mat_reduction
   (const tensor , const gmm::dense_matrix , int ni) {
 /* reduction du tenseur t par son indice ni et la matrice m.   */
-DEFINE_STATIC_THREAD_LOCAL(std::vector, tmp);
-DEFINE_STATIC_THREAD_LOCAL(multi_index, mi);
+THREAD_SAFE_STATIC std::vector tmp;
+THREAD_SAFE_STATIC multi_index mi;
 
 mi = t.sizes();
 size_type dimt = mi[ni], dim = m.ncols();
diff --git a/src/getfem/dal_basic.h b/src/getfem/dal_basic.h
index 878b996..932ca72 100644
--- a/src/getfem/dal_basic.h
+++ b/src/getfem/dal_basic.h
@@ -324,8 +324,8 @@ namespace dal
   template 
 typename dynamic_array::const_reference
   dynamic_array::operator [](size_type ii) const { 
-DEFINE_STATIC_THREAD_LOCAL_INITIALIZED(std::shared_ptr,pf,NULL);
-if (pf.get() == NULL) { pf = std::make_shared(); }
+THREAD_SAFE_STATIC std::shared_ptr pf = nullptr;
+if (pf.get() == nullptr) { pf = std::make_shared(); }
 return (ii>pks])[ii__] : *pf;
   }
 
diff --git a/src/getfem/getfem_omp.h b/src/getfem/getfem_omp.h
index 17e8a7e..13d0691 100644
--- a/src/getfem/getfem_omp.h
+++ b/src/getfem/getfem_omp.h
@@ -47,8 +47,6 @@ This is the kernel of getfem.
 
 #ifdef GETFEM_HAS_OPENMP
   #include 
-  #include  /**TODO: get rid of this dependency as soon
-   as thread_local is widely supported*/
 #endif
 
 namespace getfem
@@ -341,33 +339,9 @@ namespace getfem
   and their initialization (it's more general and portable
   then using __declspec(thread))*/
   #ifdef GETFEM_HAS_OPENMP
-
-#define DEFINE_STATIC_THREAD_LOCAL_INITIALIZED(Type,Var,initial) \
-  static boost::thread_specific_ptr ptr_##Var; \
-  if(!ptr_##Var.get()) {ptr_##Var.reset(new Type(initial));} \
-  Type& Var=*ptr_##Var;
-
-#define DEFINE_STATIC_THREAD_LOCAL(Type,Var) \
-  static boost::thread_specific_ptr ptr_##Var; \
-  if(!ptr_##Var.get()) {ptr_##Var.reset(new Type());} \
-  Type& Var=*ptr_##Var;
-
-#define DEFINE_STATIC_THREAD_LOCAL_CONSTRUCTED(Type, Var, ...) \
-  static boost::thread_specific_ptr ptr_##Var; \
-  if(!ptr_##Var.get()) {ptr_##Var.reset(new Type(__VA_ARGS__));} \
-  Type& Var=*ptr_##Var;
-
+#define THREAD_SAFE_STATIC thread_local
   #else
-
-#define DEFINE_STATIC_THREAD_LOCAL_INITIALIZED(Type,Var,initial) \
-  static Type Var(initial);
-
-#define DEFINE_STATIC_THREAD_LOCAL(Type,Var) \
-  static Type Var;
-
-#define DEFINE_STATIC_THREAD_LOCAL_CONSTRUCTED(Type, Var, ...) \
-  static Type Var(__VA_ARGS__);
-
+#define THREAD_SAFE_STATIC static
   #endif
 
   class partition_master;
diff --git a/src/getfem_fem.cc b/src/getfem_fem.cc
index 263da5c..f0c0e9e 100644
--- a/src/getfem_fem.cc
+++ b/src/getfem_fem.cc
@@ -383,8 +383,8 @@ namespace getfem {
   typedef dal::dynamic_tree_sorted 
dof_d_tab;
 
   pdof_description lagrange_dof(dim_type n) {
- 

[Getfem-commits] (no subject)

2019-02-18 Thread Andriy Andreykiv
branch: upgrading_getfem_to_cpp14
commit 7e1cc903adda5e462e648ce75a8a6ecfac9fb825
Author: aa 
Date:   Mon Feb 18 15:39:48 2019 +0100

no need for special functions anymore
---
 src/getfem_generic_assembly_functions_and_operators.cc | 15 +--
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/src/getfem_generic_assembly_functions_and_operators.cc 
b/src/getfem_generic_assembly_functions_and_operators.cc
index 3193528..14bb626 100644
--- a/src/getfem_generic_assembly_functions_and_operators.cc
+++ b/src/getfem_generic_assembly_functions_and_operators.cc
@@ -28,24 +28,11 @@
compilers
 */
 
-#if defined(_MSC_VER) && _MSC_VER < 1800
-#include 
-#include 
-#include 
-#include 
-typedef double (*BoostMathFunction)(double);
-BoostMathFunction const acosh = boost::math::acosh;
-BoostMathFunction const asinh = boost::math::asinh;
-BoostMathFunction const atanh = boost::math::atanh;
-BoostMathFunction const erf = boost::math::erf;
-BoostMathFunction const erfc = boost::math::erfc;
-#endif
-
 namespace getfem {
 
   base_matrix& __mat_aux1()
   {
-DEFINE_STATIC_THREAD_LOCAL(base_matrix, m);
+THREAD_SAFE_STATIC base_matrix m;
 return m;
   }
 



[Getfem-commits] (no subject)

2019-02-18 Thread Andriy Andreykiv
branch: upgrading_getfem_to_cpp14
commit 9b04251b1ab2bdd30ab7f02ad0ef1a234e3a16bf
Author: aa 
Date:   Mon Feb 18 15:40:11 2019 +0100

std::toupper doesn't need locale anymore
---
 src/getfem_import.cc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/getfem_import.cc b/src/getfem_import.cc
index ef0fe73..d423f0d 100644
--- a/src/getfem_import.cc
+++ b/src/getfem_import.cc
@@ -788,8 +788,7 @@ namespace getfem {
 type_name = line.substr(pos, pos2-pos);
 bool only_digits
   = (type_name.find_first_not_of("0123456789") == std::string::npos);
-const std::locale loc;
-for (auto&& c : type_name) c = std::toupper(c, loc);
+for (auto&& c : type_name) c = std::toupper(c);
 
 if (elt_types.size() < itype+1)
   elt_types.resize(itype+1);



[Getfem-commits] (no subject)

2019-02-18 Thread Andriy Andreykiv
branch: upgrading_getfem_to_cpp14
commit 169948f74c8b8f470ac75fd488d31baab729e209
Author: aa 
Date:   Mon Feb 18 15:39:13 2019 +0100

no need for boost/atomic, as standard atomic is there
---
 src/getfem/dal_static_stored_objects.h | 11 ++-
 src/getfem/getfem_context.h| 10 ++
 2 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/src/getfem/dal_static_stored_objects.h 
b/src/getfem/dal_static_stored_objects.h
index be8ca7e..16814b1 100644
--- a/src/getfem/dal_static_stored_objects.h
+++ b/src/getfem/dal_static_stored_objects.h
@@ -77,14 +77,7 @@ std::shared_ptr are used.
 
 #include "getfem/getfem_arch_config.h"
 
-#ifdef GETFEM_HAS_OPENMP
-  #include 
-  typedef boost::atomic_bool atomic_bool;
-  typedef boost::atomic atomic_int;
-#else
-  typedef int   atomic_int;
-  typedef bool  atomic_bool;
-#endif
+#include 
 
 #define DAL_STORED_OBJECT_DEBUG 0
 
@@ -298,7 +291,7 @@ namespace dal {
   /** Pointer to an object with the dependencies */
   struct enr_static_stored_object {
 pstatic_stored_object p;
-atomic_bool valid;
+std::atomic_bool valid;
 const permanence perm;
 std::set dependent_object;
 std::set dependencies;
diff --git a/src/getfem/getfem_context.h b/src/getfem/getfem_context.h
index e24f4e5..e82017b 100644
--- a/src/getfem/getfem_context.h
+++ b/src/getfem/getfem_context.h
@@ -41,13 +41,7 @@
 #include "getfem_omp.h"
 #include 
 
-#ifdef GETFEM_HAS_OPENMP
-  #include 
-  typedef boost::atomic_bool atomic_bool;
-#else
-  typedef bool  atomic_bool;
-#endif
-
+#include 
 
 namespace getfem {
   /**Deal with interdependencies of objects.
@@ -89,7 +83,7 @@ namespace getfem {
   protected :
 enum context_state { CONTEXT_NORMAL, CONTEXT_CHANGED, CONTEXT_INVALID };
 mutable context_state state;
-mutable atomic_bool touched;
+mutable std::atomic_bool touched;
 mutable std::vector dependencies;
 mutable std::vector dependent;
 typedef std::vector::iterator iterator_list;



[Getfem-commits] merge request for partitions_initiation

2019-02-14 Thread Andriy Andreykiv
Dear Yves and Kostas,

Kind request to review and merge "partitions_initiation". This is basically
a small refinement on the idea of thread independent partitioning:
 - partitions now can be set only once, to preserve the integrity of the
global storage
 - threads and partitions are initialised to unity and user code must set
them explicitly. This is to allow an arbitrary
 number of partitions at user discretion. Otherwise they couldn't be
reduced
 - small clean up

Best regards,
  Andriy


[Getfem-commits] (no subject)

2019-02-14 Thread Andriy Andreykiv
branch: partitions_initiation
commit 57f174fb2e5eae359d41d96f0d051c36b0a848b4
Merge: 55089b9 6df7941
Author: Andriy.Andreykiv 
Date:   Thu Feb 14 11:33:58 2019 +0100

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

 doc/sphinx/source/userdoc/interNMM.rst | 31 +-
 doc/sphinx/source/userdoc/model_object.rst | 11 +++
 src/gmm/gmm_real_part.h|  1 +
 3 files changed, 34 insertions(+), 9 deletions(-)



[Getfem-commits] [getfem-commits] partitions_initiation updated (55089b9 -> 57f174f)

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

  from  55089b9   cleaner error messages syntax
  adds  383842d   update the information of "Interpolation of a finite 
element method on non-matching meshes"
  adds  8516041   add model object description ``add_filtered_fem_variable``
  adds  710de08   some documentation improvements
  adds  664b86e   Fix layout of sphinx source
  adds  6df7941   minor change
   new  57f174f   Merge branch 'master' of git.sv.gnu.org:/srv/git/getfem 
into partitions_initiation


Summary of changes:
 doc/sphinx/source/userdoc/interNMM.rst | 31 +-
 doc/sphinx/source/userdoc/model_object.rst | 11 +++
 src/gmm/gmm_real_part.h|  1 +
 3 files changed, 34 insertions(+), 9 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  = 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(-)



[Getfem-commits] (no subject)

2019-01-31 Thread Andriy Andreykiv
branch: partitions_initiation
commit 8bd82f1df8c0d6dcb325b5d522733e7e7bee3c36
Author: Andriy.Andreykiv 
Date:   Thu Jan 31 11:47:17 2019 +0100

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)
---
 src/getfem/getfem_mesh_region.h | 11 +++
 src/getfem_mesh_region.cc   |  8 
 src/getfem_omp.cc   |  1 +
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/getfem/getfem_mesh_region.h b/src/getfem/getfem_mesh_region.h
index a3f414c..0b942ea 100644
--- a/src/getfem/getfem_mesh_region.h
+++ b/src/getfem/getfem_mesh_region.h
@@ -37,6 +37,7 @@
 
 #pragma once
 
+#include 
 #include 
 #include 
 #include 
@@ -72,10 +73,12 @@ namespace getfem {
  constructor is used */
 
 size_type type_; //optional type of the region
-omp_distribute partitioning_allowed; /** specifies that in
-  multithreaded code only a partition of the
-  region is visible in index() and size() methods,
-  as well as during iteration with mr_visitor */
+
+std::atomic_bool partitioning_allowed; /* specifies that in multithreaded 
code only a
+   partition of the region is visible 
in index()
+   and size() methods, as well as 
during iteration
+   with mr_visitor */
+
 mesh *parent_mesh; /* used for mesh_region "extracted" from
   a mesh (to provide feedback) */
 
diff --git a/src/getfem_mesh_region.cc b/src/getfem_mesh_region.cc
index 5cb2b59..7a5e6fa 100644
--- a/src/getfem_mesh_region.cc
+++ b/src/getfem_mesh_region.cc
@@ -34,26 +34,26 @@ namespace getfem {
 
   mesh_region::mesh_region()
 : p(std::make_shared()), id_(size_type(-2)), type_(size_type(-1)),
-partitioning_allowed(true), parent_mesh(nullptr){
+partitioning_allowed{true}, parent_mesh(nullptr){
 if (me_is_multithreaded_now()) prohibit_partitioning();
 mark_region_changed();
   }
 
   mesh_region::mesh_region(size_type id__) : id_(id__), type_(size_type(-1)),
-partitioning_allowed(true), parent_mesh(nullptr){
+partitioning_allowed{true}, parent_mesh(nullptr){
 mark_region_changed();
   }
 
   mesh_region::mesh_region(mesh& m, size_type id__, size_type type) :
 p(std::make_shared()), id_(id__), type_(type),
-partitioning_allowed(true), parent_mesh(){
+partitioning_allowed{true}, parent_mesh(){
 if (me_is_multithreaded_now()) prohibit_partitioning();
 mark_region_changed();
   }
 
   mesh_region::mesh_region(const dal::bit_vector )
 : p(std::make_shared()), id_(size_type(-2)), type_(size_type(-1)),
-partitioning_allowed(true), parent_mesh(nullptr){
+partitioning_allowed{true}, parent_mesh(nullptr){
 if (me_is_multithreaded_now()) prohibit_partitioning();
 add(bv);
 mark_region_changed();
diff --git a/src/getfem_omp.cc b/src/getfem_omp.cc
index 438bc5e..888e22a 100644
--- a/src/getfem_omp.cc
+++ b/src/getfem_omp.cc
@@ -234,6 +234,7 @@ namespace getfem{
   partition_master::partition_master()
 : nb_user_threads{1}, nb_partitions{1} {
 partitions_updated = false;
+set_num_threads(1);
 update_partitions();
   }
 



[Getfem-commits] [getfem-commits] partitions_initiation updated (53a1931 -> 8bd82f1)

2019-01-31 Thread Andriy Andreykiv
andrico pushed a change to branch partitions_initiation.

  from  53a1931   - safer omp_distribute component extraction (in Debug)  - 
default number of threads and partitions is 1, increasing threads automatically 
increases partitions unless specific number of partitions was requested.  - 
corrected constructions with universal references
   new  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)


Summary of changes:
 src/getfem/getfem_mesh_region.h | 11 +++
 src/getfem_mesh_region.cc   |  8 
 src/getfem_omp.cc   |  1 +
 3 files changed, 12 insertions(+), 8 deletions(-)



[Getfem-commits] (no subject)

2019-01-30 Thread Andriy Andreykiv
branch: partitions_initiation
commit 53a1931c59fdc88c88190f79fbda98f5724da2cc
Author: Andriy.Andreykiv 
Date:   Wed Jan 30 15:33:07 2019 +0100

- safer omp_distribute component extraction (in Debug)
 - default number of threads and partitions is 1, increasing threads 
automatically increases partitions unless specific number of partitions was 
requested.
 - corrected constructions with universal references
---
 src/getfem/getfem_omp.h | 51 +
 src/getfem_omp.cc   | 27 ++
 2 files changed, 45 insertions(+), 33 deletions(-)

diff --git a/src/getfem/getfem_omp.h b/src/getfem/getfem_omp.h
index faffba4..17e8a7e 100644
--- a/src/getfem/getfem_omp.h
+++ b/src/getfem/getfem_omp.h
@@ -159,6 +159,15 @@ namespace getfem
 template
 class omp_distribute_impl;
 
+template
+inline auto safe_component(V , size_type i) -> decltype(v[i]){
+  GMM_ASSERT2(i < v.size(),
+  i << "-th partition is not available. "
+  "Probably on_thread_update "
+  "should have been called first");
+  return v[i];
+}
+
 template 
 class omp_distribute_impl {
 private:
@@ -183,37 +192,41 @@ namespace getfem
 
   template 
explicit omp_distribute_impl(args&&... value){
-thread_values.reserve(thread_policy::num_threads());
-for (size_type i = 0; i != thread_policy::num_threads(); ++i){
-  thread_values.emplace_back(value...);
+thread_values.reserve(num_threads());
+for (size_type i = 0; i != num_threads(); ++i){
+  thread_values.emplace_back(std::forward(value)...);
 }
   }
 
   operator T& (){
-return thread_values[thread_policy::this_thread()];
+return operator()(this_thread());
   }
 
   operator const T& () const {
-return thread_values[thread_policy::this_thread()];
+return operator()(this_thread());
   }
 
   T& thrd_cast(){
-return thread_values[thread_policy::this_thread()];
+return operator()(this_thread());
   }
 
   const T& thrd_cast() const {
-return thread_values[thread_policy::this_thread()];
+return operator()(this_thread());
   }
 
   T& operator()(size_type i) {
-return thread_values[i];
+return safe_component(thread_values, i);
+  }
+
+  const T& operator()(size_type i) const {
+return safe_component(thread_values, i);
   }
 
   void on_thread_update() {
-if (thread_values.size() == thread_policy::num_threads()) return;
+if (thread_values.size() == num_threads()) return;
 GLOBAL_OMP_GUARD
-if (thread_values.size() != thread_policy::num_threads()) {
-  thread_values.resize(thread_policy::num_threads());
+if (thread_values.size() != num_threads()) {
+  thread_values.resize(num_threads());
 }
   }
 
@@ -225,17 +238,13 @@ namespace getfem
 return thread_policy::this_thread();
   }
 
-  const T& operator()(size_type i) const {
-return thread_values[i];
-  }
-
   T& operator = (const T& x){
 if (me_is_multithreaded_now()){
-  thread_values[thread_policy::this_thread()] = x;
+  thrd_cast() = x;
 }
 else all_threads() = x;
 
-return thread_values[thread_policy::this_thread()];
+return *this;
   }
 
   all_values_proxy all_threads(){
@@ -254,7 +263,7 @@ namespace getfem
 
   template 
   explicit omp_distribute_impl(args&&... value)
-: base(value...)
+: base(std::forward(value)...)
   {}
 
   T& operator[](size_type i){
@@ -281,7 +290,7 @@ namespace getfem
 
   template 
   explicit omp_distribute_impl(Args&&... value)
-: base(value...)
+: base(std::forward(value)...)
   {}
 
   operator bool () const {
@@ -319,7 +328,7 @@ namespace getfem
 
 template 
 explicit omp_distribute(args&&... value)
-  : base(value...)
+  : base(std::forward(value)...)
 {}
 
 auto operator = (const T& x) -> decltype(std::declval() = x){
@@ -503,4 +512,4 @@ namespace getfem
 
   #endif
 
-}  /* end of namespace getfem. */
+}  /* end of namespace getfem. */
\ No newline at end of file
diff --git a/src/getfem_omp.cc b/src/getfem_omp.cc
index 5097a4c..438bc5e 100644
--- a/src/getfem_omp.cc
+++ b/src/getfem_omp.cc
@@ -179,11 +179,20 @@ namespace getfem{
   }
 
   void partition_master::check_threads(){
+GLOBAL_OMP_GUARD
+auto must_update = false;
 if (nb_user_threads != true_thread_policy::num_threads()){
-  update_partitions();
   nb_user_threads = true_thread_policy::num_threads();
+  must_update = true;
+}
+if (nb_partitions < nb_user_threads && !partitions_set_by_user){
+  nb_partitions = nb_user_threads;
+  

[Getfem-commits] [getfem-commits] partitions_initiation updated (75a1155 -> 53a1931)

2019-01-30 Thread Andriy Andreykiv
andrico pushed a change to branch partitions_initiation.

  from  75a1155   allowing to have lower number of partitions than 
max_concurrency
   new  53a1931   - safer omp_distribute component extraction (in Debug)  - 
default number of threads and partitions is 1, increasing threads automatically 
increases partitions unless specific number of partitions was requested.  - 
corrected constructions with universal references


Summary of changes:
 src/getfem/getfem_omp.h | 51 +
 src/getfem_omp.cc   | 27 ++
 2 files changed, 45 insertions(+), 33 deletions(-)



[Getfem-commits] [getfem-commits] branch partitions_initiation created (now 75a1155)

2019-01-24 Thread Andriy Andreykiv
andrico pushed a change to branch partitions_initiation.

at  75a1155   allowing to have lower number of partitions than 
max_concurrency

This branch includes the following new commits:

   new  75a1155   allowing to have lower number of partitions than 
max_concurrency




[Getfem-commits] (no subject)

2019-01-24 Thread Andriy Andreykiv
branch: partitions_initiation
commit 75a1155d123a568a6016c59447cdf016e8e8059c
Author: Andriy.Andreykiv 
Date:   Thu Jan 24 17:00:46 2019 +0100

allowing to have lower number of partitions than max_concurrency
---
 src/getfem/getfem_omp.h |  1 +
 src/getfem_omp.cc   | 15 +++
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/getfem/getfem_omp.h b/src/getfem/getfem_omp.h
index 4e86fdc..faffba4 100644
--- a/src/getfem/getfem_omp.h
+++ b/src/getfem/getfem_omp.h
@@ -446,6 +446,7 @@ namespace getfem
 thread_behaviour behaviour = thread_behaviour::partition_threads;
 std::atomic partitions_updated{false};
 size_type nb_partitions;
+bool partitions_set_by_user = false;
 
 static partition_master instance;
   };
diff --git a/src/getfem_omp.cc b/src/getfem_omp.cc
index 5f1bd89..5097a4c 100644
--- a/src/getfem_omp.cc
+++ b/src/getfem_omp.cc
@@ -183,6 +183,7 @@ namespace getfem{
   update_partitions();
   nb_user_threads = true_thread_policy::num_threads();
 }
+if (!partitions_set_by_user) set_nb_partitions(max_concurrency());
   }
 
   void partition_master::set_nb_partitions(size_type n){
@@ -192,11 +193,12 @@ namespace getfem{
   update_partitions();
   dal::singletons_manager::on_partitions_change();
 }
-else{
+else if (n < nb_partitions){
   GMM_WARNING1("Not reducing number of partitions from "
<< nb_partitions <<" to " << n <<
" as it might invalidate global storage");
 }
+partitions_set_by_user = true;
   }
 
   partition_iterator partition_master::begin(){
@@ -221,7 +223,13 @@ namespace getfem{
 
   partition_master::partition_master()
 : nb_user_threads{true_thread_policy::num_threads()},
-  nb_partitions{max_concurrency()} {
+  nb_partitions{1} // keeping at 1 to allow the user setting it
+   // to a number below max_concurrency.
+   // If the user doesn't set it, it will be set
+   // to max_concurrency before the fist parallel
+   // section (reducing nb_partitions is not allowed
+   // to preserve global storage)
+  {
 partitions_updated = false;
 update_partitions();
   }
@@ -259,8 +267,7 @@ namespace getfem{
   void partition_master::update_partitions(){
 partitions_updated = false;
 
-auto guard = omp_guard{};
-GMM_NOPERATION(guard);
+GLOBAL_OMP_GUARD
 
 if (partitions_updated) return;
 



[Getfem-commits] [getfem-commits] static_initialization_for_singleton_instance_pointer updated (7e1082f -> ed69b3f)

2019-01-16 Thread Andriy Andreykiv
andrico pushed a change to branch 
static_initialization_for_singleton_instance_pointer.

  from  7e1082f   Merge branch 'master' of git.sv.gnu.org:/srv/git/getfem 
into static_initialization_for_singleton_instance_pointer
   new  ed69b3f   fixing the issue when singleton pointer is not 
initialized before the other global objects


Summary of changes:
 src/getfem/dal_singleton.h | 30 ++
 1 file changed, 18 insertions(+), 12 deletions(-)



[Getfem-commits] (no subject)

2019-01-16 Thread Andriy Andreykiv
branch: static_initialization_for_singleton_instance_pointer
commit ed69b3fc110f7160f7bf689a730eb25c5e3b0138
Author: andrico 
Date:   Wed Jan 16 23:57:10 2019 +0100

fixing the issue when singleton pointer is not initialized before the other 
global objects
---
 src/getfem/dal_singleton.h | 30 ++
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/src/getfem/dal_singleton.h b/src/getfem/dal_singleton.h
index 3bba935..c063598 100644
--- a/src/getfem/dal_singleton.h
+++ b/src/getfem/dal_singleton.h
@@ -80,21 +80,26 @@ namespace dal {
   template 
   class singleton_instance : public singleton_instance_base {
 
-static getfem::omp_distribute* pointer;
+static getfem::omp_distribute* initializing_pointer;
+
+static getfem::omp_distribute*& pointer() {
+  static auto p = new getfem::omp_distribute{};
+  return p;
+}
 
 static T*& instance_pointer() {
-  return pointer->thrd_cast();
+  return pointer()->thrd_cast();
 }
 
 static T*& instance_pointer(size_t ithread) {
-  return (*pointer)(ithread);
+  return (*pointer())(ithread);
 }
 
   public:
 
 /**Instance from thread ithread*/
 inline static T& instance(size_t ithread) {
-  pointer->on_thread_update();
+  pointer()->on_thread_update();
   T*& tinstance_ = instance_pointer(ithread);
   if (!tinstance_) {
 tinstance_ = new T();
@@ -110,11 +115,11 @@ namespace dal {
 }
 
 inline static size_type num_threads() {
-  return pointer->num_threads();
+  return pointer()->num_threads();
 }
 
 inline static size_type this_thread() {
-  return pointer->this_thread();
+  return pointer()->this_thread();
 }
 
 int level() const override {
@@ -122,21 +127,22 @@ namespace dal {
 }
 
 ~singleton_instance() {
-  if (!pointer) return;
-  for(size_t i = 0; i != pointer->num_threads(); ++i) {
-auto _singleton = (*pointer)(i);
+  if (!pointer()) return;
+  for(size_t i = 0; i != pointer()->num_threads(); ++i) {
+auto _singleton = (*pointer())(i);
 if(p_singleton){
   delete p_singleton;
   p_singleton = nullptr;
 }
   }
-  delete pointer;
-  pointer = nullptr;
+  delete pointer();
+  pointer() = nullptr;
+  if (initializing_pointer) initializing_pointer = nullptr;
 }
   };
 
   template getfem::omp_distribute*
-  singleton_instance::pointer = new getfem::omp_distribute{};
+  singleton_instance::initializing_pointer = singleton_instance::pointer();
 
   /** singleton class.
 



[Getfem-commits] [getfem-commits] static_initialization_for_singleton_instance_pointer updated (dcd7d39 -> 7e1082f)

2019-01-16 Thread Andriy Andreykiv
andrico pushed a change to branch 
static_initialization_for_singleton_instance_pointer.

  from  dcd7d39   improving multi-threaded performance by reducing the 
usage of muteces when the shared data hasn't changed.
  adds  f04b73d   Add asm_lumped_mass_matrix
  adds  b6a52a7   Merge branch 'master' of 
ssh://git.sv.gnu.org:/srv/git/getfem into devel-tetsuo-asm_lumped_mass_matrix
  adds  ff6df87   Fix by two loops which can be very inefficient for large 
matrices
  adds  b878a0b   Minor Fix
  adds  7d8db6b   Merge branch 'devel-tetsuo-asm_lumped_mass_matrix' of 
ssh://git.sv.gnu.org:/srv/git/getfem into devel-tetsuo-asm_lumped_mass_matrix
   new  7e1082f   Merge branch 'master' of git.sv.gnu.org:/srv/git/getfem 
into static_initialization_for_singleton_instance_pointer


Summary of changes:
 src/getfem/getfem_assembling.h | 22 ++
 1 file changed, 22 insertions(+)



[Getfem-commits] (no subject)

2019-01-16 Thread Andriy Andreykiv
branch: static_initialization_for_singleton_instance_pointer
commit 7e1082f500fb3e35d9959418d31cb5bc8d8ca6f7
Merge: dcd7d39 7d8db6b
Author: Andriy.Andreykiv 
Date:   Wed Jan 16 16:13:23 2019 +0100

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

 src/getfem/getfem_assembling.h | 22 ++
 1 file changed, 22 insertions(+)



[Getfem-commits] (no subject)

2019-01-16 Thread Andriy Andreykiv
branch: static_initialization_for_singleton_instance_pointer
commit dcd7d3938a1f2bdfeee8c42a33b35100cce29011
Author: Andriy.Andreykiv 
Date:   Wed Jan 16 15:56:02 2019 +0100

improving multi-threaded performance by reducing the usage of muteces when 
the shared data hasn't changed.
---
 src/bgeot_geometric_trans.cc   |  6 ++--
 src/dal_static_stored_objects.cc   |  4 +--
 src/getfem/getfem_fem.h| 38 +++---
 src/getfem/getfem_omp.h| 18 ++
 ...fem_generic_assembly_functions_and_operators.cc |  9 ++---
 src/getfem_omp.cc  | 14 +---
 6 files changed, 50 insertions(+), 39 deletions(-)

diff --git a/src/bgeot_geometric_trans.cc b/src/bgeot_geometric_trans.cc
index 1ea29e9..0b1cc6a 100644
--- a/src/bgeot_geometric_trans.cc
+++ b/src/bgeot_geometric_trans.cc
@@ -506,7 +506,8 @@ namespace bgeot {
 mutable bool hess_computed_ = false;
 
 void compute_grad_() const {
-  auto guard = getfem::omp_guard{};
+  if (grad_computed_) return;
+  GLOBAL_OMP_GUARD
   if (grad_computed_) return;
   size_type R = trans.size();
   dim_type n = dim();
@@ -521,7 +522,8 @@ namespace bgeot {
 }
 
 void compute_hess_() const {
-  auto guard = getfem::omp_guard{};
+  if (hess_computed_) return;
+  GLOBAL_OMP_GUARD
   if (hess_computed_) return;
   size_type R = trans.size();
   dim_type n = dim();
diff --git a/src/dal_static_stored_objects.cc b/src/dal_static_stored_objects.cc
index 38810f5..fbe5f21 100644
--- a/src/dal_static_stored_objects.cc
+++ b/src/dal_static_stored_objects.cc
@@ -310,8 +310,8 @@ namespace dal {
 
   void del_stored_objects(std::list _delete,
   bool ignore_unstored) {
-getfem::omp_guard lock;
-GMM_NOPERATION(lock);
+
+GLOBAL_OMP_GUARD
 
 ON_STORED_DEBUG(if (dal_static_stored_tab_valid__) return);
 
diff --git a/src/getfem/getfem_fem.h b/src/getfem/getfem_fem.h
index a6e1a95..8e71614 100644
--- a/src/getfem/getfem_fem.h
+++ b/src/getfem/getfem_fem.h
@@ -501,42 +501,44 @@ namespace getfem {
   protected :
 std::vector base_;
 mutable std::vector> grad_, hess_;
-mutable bool grad_computed_;
-mutable bool hess_computed_;
+mutable bool grad_computed_ = false;
+mutable bool hess_computed_ = false;
 
 void compute_grad_() const {
-  auto guard = getfem::omp_guard{};
+  if (grad_computed_) return;
+  GLOBAL_OMP_GUARD
   if (grad_computed_) return;
   size_type R = nb_base_components(0);
   dim_type n = dim();
   grad_.resize(R);
   for (size_type i = 0; i < R; ++i) {
-   grad_[i].resize(n);
-   for (dim_type j = 0; j < n; ++j) {
- grad_[i][j] = base_[i]; grad_[i][j].derivative(j);
-   }
+grad_[i].resize(n);
+for (dim_type j = 0; j < n; ++j) {
+  grad_[i][j] = base_[i]; grad_[i][j].derivative(j);
+}
   }
   grad_computed_ = true;
 }
 
 void compute_hess_() const {
-  auto guard = getfem::omp_guard{};
+  if (hess_computed_) return;
+  GLOBAL_OMP_GUARD
   if (hess_computed_) return;
   size_type R = nb_base_components(0);
   dim_type n = dim();
   hess_.resize(R);
   for (size_type i = 0; i < R; ++i) {
-   hess_[i].resize(n*n);
-   for (dim_type j = 0; j < n; ++j) {
- for (dim_type k = 0; k < n; ++k) {
-   hess_[i][j+k*n] = base_[i];
-   hess_[i][j+k*n].derivative(j); hess_[i][j+k*n].derivative(k);
- }
-   }
+hess_[i].resize(n*n);
+for (dim_type j = 0; j < n; ++j) {
+  for (dim_type k = 0; k < n; ++k) {
+hess_[i][j+k*n] = base_[i];
+hess_[i][j+k*n].derivative(j); hess_[i][j+k*n].derivative(k);
+  }
+}
   }
   hess_computed_ = true;
 }
-
+
   public :
 
 /// Gives the array of basic functions (components).
@@ -586,8 +588,6 @@ namespace getfem {
*it = bgeot::to_scalar(hess_[i][j+k*n].eval(x.begin()));
 }
 
-fem() : grad_computed_(false), hess_computed_(false){}
-
   };
 
   /** Classical polynomial FEM. */
@@ -858,7 +858,7 @@ namespace getfem {
 
 gmm::clear(val);
 base_tensor Z; real_base_value(c, Z);
-
+
 for (size_type j = 0; j < nbdof; ++j) {
   for (size_type q = 0; q < Qmult; ++q) {
 typename gmm::linalg_traits::value_type co = coeff[j*Qmult+q];
diff --git a/src/getfem/getfem_omp.h b/src/getfem/getfem_omp.h
index ca1aec6..e9ddeac 100644
--- a/src/getfem/getfem_omp.h
+++ b/src/getfem/getfem_omp.h
@@ -58,13 +58,14 @@ namespace getfem
 #ifdef GETFEM_HAS_OPENMP
   //declaring a thread lock, to protect multi-threaded accesses to
   //asserts, traces and warnings. Using a global mutex
-  class omp_guard: public std::lock_guard
+  class omp_guard
   {
   public:
 omp_guard();
 
   private:
-static std::recursive_mutex mutex_;
+

[Getfem-commits] [getfem-commits] static_initialization_for_singleton_instance_pointer updated (0b2282d -> dcd7d39)

2019-01-16 Thread Andriy Andreykiv
andrico pushed a change to branch 
static_initialization_for_singleton_instance_pointer.

  from  0b2282d   initializing singleton_instance pointer as a static 
variable to prevent initialization in parallel open_mp blocks
   new  dcd7d39   improving multi-threaded performance by reducing the 
usage of muteces when the shared data hasn't changed.


Summary of changes:
 src/bgeot_geometric_trans.cc   |  6 ++--
 src/dal_static_stored_objects.cc   |  4 +--
 src/getfem/getfem_fem.h| 38 +++---
 src/getfem/getfem_omp.h| 18 ++
 ...fem_generic_assembly_functions_and_operators.cc |  9 ++---
 src/getfem_omp.cc  | 14 +---
 6 files changed, 50 insertions(+), 39 deletions(-)



[Getfem-commits] (no subject)

2019-01-14 Thread Andriy Andreykiv
branch: static_initialization_for_singleton_instance_pointer
commit 0b2282d0b93af509b086c30159241aff99909e52
Author: Andriy.Andreykiv 
Date:   Mon Jan 14 13:47:16 2019 +0100

initializing singleton_instance pointer as a static variable to prevent 
initialization in parallel open_mp blocks
---
 src/getfem/dal_singleton.h | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/getfem/dal_singleton.h b/src/getfem/dal_singleton.h
index 891c00f..3bba935 100644
--- a/src/getfem/dal_singleton.h
+++ b/src/getfem/dal_singleton.h
@@ -80,24 +80,21 @@ namespace dal {
   template 
   class singleton_instance : public singleton_instance_base {
 
-static getfem::omp_distribute*& omp_distro_pointer() {
-  static auto pointer = new getfem::omp_distribute{};
-  return pointer;
-}
+static getfem::omp_distribute* pointer;
 
 static T*& instance_pointer() {
-  return omp_distro_pointer()->thrd_cast();
+  return pointer->thrd_cast();
 }
 
 static T*& instance_pointer(size_t ithread) {
-  return (*omp_distro_pointer())(ithread);
+  return (*pointer)(ithread);
 }
 
   public:
 
 /**Instance from thread ithread*/
 inline static T& instance(size_t ithread) {
-  omp_distro_pointer()->on_thread_update();
+  pointer->on_thread_update();
   T*& tinstance_ = instance_pointer(ithread);
   if (!tinstance_) {
 tinstance_ = new T();
@@ -113,11 +110,11 @@ namespace dal {
 }
 
 inline static size_type num_threads() {
-  return omp_distro_pointer()->num_threads();
+  return pointer->num_threads();
 }
 
 inline static size_type this_thread() {
-  return omp_distro_pointer()->this_thread();
+  return pointer->this_thread();
 }
 
 int level() const override {
@@ -125,19 +122,22 @@ namespace dal {
 }
 
 ~singleton_instance() {
-  if (!omp_distro_pointer()) return;
-  for(size_t i = 0; i != omp_distro_pointer()->num_threads(); ++i) {
-auto _singleton = (*omp_distro_pointer())(i);
+  if (!pointer) return;
+  for(size_t i = 0; i != pointer->num_threads(); ++i) {
+auto _singleton = (*pointer)(i);
 if(p_singleton){
   delete p_singleton;
   p_singleton = nullptr;
 }
   }
-  delete omp_distro_pointer();
-  omp_distro_pointer() = nullptr;
+  delete pointer;
+  pointer = nullptr;
 }
   };
 
+  template getfem::omp_distribute*
+  singleton_instance::pointer = new getfem::omp_distribute{};
+
   /** singleton class.
 
   usage:



[Getfem-commits] [getfem-commits] branch static_initialization_for_singleton_instance_pointer created (now 0b2282d)

2019-01-14 Thread Andriy Andreykiv
andrico pushed a change to branch 
static_initialization_for_singleton_instance_pointer.

at  0b2282d   initializing singleton_instance pointer as a static 
variable to prevent initialization in parallel open_mp blocks

This branch includes the following new commits:

   new  0b2282d   initializing singleton_instance pointer as a static 
variable to prevent initialization in parallel open_mp blocks




[Getfem-commits] (no subject)

2018-12-28 Thread Andriy Andreykiv
branch: returning_omp_pragma
commit dda317b3bacf27e1a176b69eb45b948946c48a3b
Author: andrico 
Date:   Fri Dec 28 22:00:11 2018 +0100

returning accidentally removed #pragma omp
---
 src/getfem_omp.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/getfem_omp.cc b/src/getfem_omp.cc
index 64155dd..28159b9 100644
--- a/src/getfem_omp.cc
+++ b/src/getfem_omp.cc
@@ -321,6 +321,7 @@ namespace getfem{
   void parallel_execution(std::function lambda,
   bool iterate_over_partitions){
 parallel_boilerplate boilerplate;
+#pragma omp parallel default(shared)
 {
   if (iterate_over_partitions) {
 for (auto & : partition_master::get()) {



[Getfem-commits] [getfem-commits] branch returning_omp_pragma created (now dda317b)

2018-12-28 Thread Andriy Andreykiv
andrico pushed a change to branch returning_omp_pragma.

at  dda317b   returning accidentally removed #pragma omp

This branch includes the following new commits:

   new  dda317b   returning accidentally removed #pragma omp




[Getfem-commits] (no subject)

2018-12-26 Thread Andriy Andreykiv
branch: consistent_partitioning_for_open_mp
commit 56a1522b565a7246b02b06affcf1d62128743e9d
Author: andrico 
Date:   Wed Dec 26 17:03:28 2018 +0100

removing commented out or GCC specific pragmas
---
 src/getfem/getfem_interpolation.h | 3 ---
 src/getfem_omp.cc | 4 
 2 files changed, 7 deletions(-)

diff --git a/src/getfem/getfem_interpolation.h 
b/src/getfem/getfem_interpolation.h
index 6f114ef..51e2e2a 100644
--- a/src/getfem/getfem_interpolation.h
+++ b/src/getfem/getfem_interpolation.h
@@ -706,8 +706,6 @@ namespace getfem {
   omp_distribute V_distributed;
   auto partitioning_allowed = rg_source.is_partitioning_allowed();
   rg_source.prohibit_partitioning();
-  // #pragma GCC diagnostic push
-  // #pragma GCC diagnostic ignored "-Wembedded-directive"
   GETFEM_OMP_PARALLEL(
   auto _thrd = V_distributed.thrd_cast();
   gmm::resize(V_thrd, V.size());
@@ -720,7 +718,6 @@ namespace getfem {
   if (gmm::abs(V_thrd[i]) > EPS) V[i] = V_thrd[i];
 }
   )
-// #pragma GCC diagnostic pop
   if (partitioning_allowed) rg_source.allow_partitioning();
 }
   }
diff --git a/src/getfem_omp.cc b/src/getfem_omp.cc
index e662683..64155dd 100644
--- a/src/getfem_omp.cc
+++ b/src/getfem_omp.cc
@@ -321,15 +321,11 @@ namespace getfem{
   void parallel_execution(std::function lambda,
   bool iterate_over_partitions){
 parallel_boilerplate boilerplate;
-#pragma omp parallel default(shared)
 {
   if (iterate_over_partitions) {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wunused-variable"
 for (auto & : partition_master::get()) {
   boilerplate.run_lamda(lambda);
 }
-#pragma GCC diagnostic pop
   }
   else {
 boilerplate.run_lamda(lambda);



[Getfem-commits] (no subject)

2018-12-26 Thread Andriy Andreykiv
branch: consistent_partitioning_for_open_mp
commit de60c3d00214c6c732b1c441b6a623f72161c09b
Author: andrico 
Date:   Wed Dec 26 17:08:33 2018 +0100

partitions_updated proper initialization
---
 src/getfem/getfem_omp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/getfem/getfem_omp.h b/src/getfem/getfem_omp.h
index 299a815..ca1aec6 100644
--- a/src/getfem/getfem_omp.h
+++ b/src/getfem/getfem_omp.h
@@ -440,7 +440,7 @@ namespace getfem
 omp_distribute current_partition;
 std::atomic nb_user_threads;
 thread_behaviour behaviour = thread_behaviour::partition_threads;
-std::atomic partitions_updated;
+std::atomic partitions_updated{false};
 size_type nb_partitions;
 
 static partition_master instance;



[Getfem-commits] [getfem-commits] consistent_partitioning_for_open_mp updated (9770d9d -> f217241)

2018-12-26 Thread Andriy Andreykiv
andrico pushed a change to branch consistent_partitioning_for_open_mp.

  from  9770d9d   Some small fixes for consistent partionning for open_mp
   new  f217241   fixing segmentation fault caused by the fact that 
omp_distribute for singletons was destroyed before the objects from it were 
deleted. Fixed by creating it dynamically and deleting only when its content 
was emptied


Summary of changes:
 src/getfem/dal_singleton.h | 28 
 1 file changed, 16 insertions(+), 12 deletions(-)



[Getfem-commits] (no subject)

2018-12-26 Thread Andriy Andreykiv
branch: consistent_partitioning_for_open_mp
commit f217241b036404d43fe3c5cdef47a10546546354
Author: andrico 
Date:   Wed Dec 26 16:50:36 2018 +0100

fixing segmentation fault caused by the fact that omp_distribute for 
singletons was destroyed before the objects from it were deleted. Fixed by 
creating it dynamically and deleting only when its content was emptied
---
 src/getfem/dal_singleton.h | 28 
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/src/getfem/dal_singleton.h b/src/getfem/dal_singleton.h
index 282cb5d..891c00f 100644
--- a/src/getfem/dal_singleton.h
+++ b/src/getfem/dal_singleton.h
@@ -80,24 +80,24 @@ namespace dal {
   template 
   class singleton_instance : public singleton_instance_base {
 
-static getfem::omp_distribute& omp_distro() {
-  static auto instance = getfem::omp_distribute{};
-  return instance;
+static getfem::omp_distribute*& omp_distro_pointer() {
+  static auto pointer = new getfem::omp_distribute{};
+  return pointer;
 }
 
 static T*& instance_pointer() {
-  return omp_distro().thrd_cast();
+  return omp_distro_pointer()->thrd_cast();
 }
 
 static T*& instance_pointer(size_t ithread) {
-  return omp_distro()(ithread);
+  return (*omp_distro_pointer())(ithread);
 }
 
   public:
 
 /**Instance from thread ithread*/
 inline static T& instance(size_t ithread) {
-  omp_distro().on_thread_update();
+  omp_distro_pointer()->on_thread_update();
   T*& tinstance_ = instance_pointer(ithread);
   if (!tinstance_) {
 tinstance_ = new T();
@@ -113,11 +113,11 @@ namespace dal {
 }
 
 inline static size_type num_threads() {
-  return omp_distro().num_threads();
+  return omp_distro_pointer()->num_threads();
 }
 
 inline static size_type this_thread() {
-  return omp_distro().this_thread();
+  return omp_distro_pointer()->this_thread();
 }
 
 int level() const override {
@@ -125,12 +125,16 @@ namespace dal {
 }
 
 ~singleton_instance() {
-  for(size_t i = 0; i != omp_distro().num_threads(); ++i) {
-if(omp_distro()(i)){
-  delete omp_distro()(i);
-  omp_distro()(i) = nullptr;
+  if (!omp_distro_pointer()) return;
+  for(size_t i = 0; i != omp_distro_pointer()->num_threads(); ++i) {
+auto _singleton = (*omp_distro_pointer())(i);
+if(p_singleton){
+  delete p_singleton;
+  p_singleton = nullptr;
 }
   }
+  delete omp_distro_pointer();
+  omp_distro_pointer() = nullptr;
 }
   };
 



[Getfem-commits] (no subject)

2018-12-21 Thread Andriy Andreykiv
branch: consistent_partitioning_for_open_mp
commit 407e1d8645d230bf7dcb802b5b6f0a5264f85026
Author: Andriy.Andreykiv 
Date:   Mon Nov 19 12:03:05 2018 +0100

Macro that encapsulates the parallel Open MP run
---
 src/getfem/getfem_omp.h | 12 +---
 src/getfem_models.cc| 30 +++---
 src/getfem_omp.cc   | 12 +++-
 3 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/src/getfem/getfem_omp.h b/src/getfem/getfem_omp.h
index 3147a5e..d264c7c 100644
--- a/src/getfem/getfem_omp.h
+++ b/src/getfem/getfem_omp.h
@@ -377,15 +377,21 @@ namespace getfem
 /**vector of pointers to caught exceptions*/
 std::vector caughtExceptions() const;
 void rethrow();
-
+
   private:
 void captureException();
 
 std::vector exceptions_;
   };
 
+  void parallel_execution(std::function lambda);
 
-}
+#ifdef GETFEM_HAVE_OPENMP
+  #define GETFEM_OMP_PARALLEL(body) parallel_execution([&](){body;});
+#else
+  #define GETFEM_OMP_PARALLEL(body) body
+#endif
 
-#endif //GETFEM_OMP
+}
 
+#endif //GETFEM_OMP
\ No newline at end of file
diff --git a/src/getfem_models.cc b/src/getfem_models.cc
index 4f55c21..288569e 100644
--- a/src/getfem_models.cc
+++ b/src/getfem_models.cc
@@ -516,22 +516,14 @@ namespace getfem {
   {
 gmm::clear(rTM);
 distro  distro_rTM(rTM);
-gmm::standard_locale locale;
-open_mp_is_running_properly check;
-thread_exception exception;
-#pragma omp parallel default(shared)
-{
-  exception.run([&]
-  {
+GETFEM_OMP_PARALLEL(
 ga_workspace workspace(*this);
 for (const auto  : generic_expressions)
   workspace.add_expression(ge.expr, ge.mim, ge.region,
-  2, ge.secondary_domain);
+   2, ge.secondary_domain);
 workspace.set_assembled_matrix(distro_rTM);
 workspace.assembly(2);
-  });
-} //parallel
-exception.rethrow();
+);
   } //distro scope
   gmm::add
 (gmm::sub_matrix(rTM, vdescr.I, multdescr.I), MM);
@@ -1939,13 +1931,7 @@ namespace getfem {
 list_distro rveclist_sym(brick.rveclist_sym[rhs_ind]);
 
 /*running the assembly in parallel*/
-gmm::standard_locale locale;
-open_mp_is_running_properly check;
-thread_exception exception;
-#pragma omp parallel default(shared)
-{
-  exception.run([&]
-  {
+GETFEM_OMP_PARALLEL(
 brick.pbr->asm_real_tangent_terms(*this, ib, brick.vlist,
   brick.dlist, brick.mims,
   rmatlist,
@@ -1953,9 +1939,7 @@ namespace getfem {
   rveclist_sym,
   brick.region,
   version);
-  } );
-}
-exception.rethrow();
+   );
   }
   brick.pbr->real_post_assembly_in_serial(*this, ib, brick.vlist,
   brick.dlist, brick.mims,
@@ -3409,7 +3393,7 @@ model_complex_plain_vector &
 
 return md.add_brick(pbr, vl, dl, tl, model::mimlist(1, ), region);
   }
-  
+
   size_type add_source_term
   (model , const mesh_im , const std::string , size_type region,
const std::string , const std::string ,
@@ -3426,7 +3410,7 @@ model_complex_plain_vector &
 return add_source_term_(md, mim, expr, region, brickname, directvarname,
 directdataname, return_if_nonlin, 
secondary_domain);
   }
-  
+
   // --
   //
   // Linear generic assembly brick
diff --git a/src/getfem_omp.cc b/src/getfem_omp.cc
index 3bb9b65..1c0c084 100644
--- a/src/getfem_omp.cc
+++ b/src/getfem_omp.cc
@@ -161,4 +161,14 @@ namespace getfem{
 exceptions_[this_thread()] = std::current_exception();
   }
 
-}
+  void parallel_execution(std::function lambda){
+gmm::standard_locale locale;
+thread_exception exception;
+#pragma omp parallel default(shared)
+{
+  exception.run([&]{lambda();});
+}
+exception.rethrow();
+  }
+
+}
\ No newline at end of file



[Getfem-commits] (no subject)

2018-12-21 Thread Andriy Andreykiv
branch: consistent_partitioning_for_open_mp
commit 059c20179e0cb3a1733003adf05cae5d33b9724a
Merge: 407e1d8 e68cc96
Author: Andriy.Andreykiv 
Date:   Fri Dec 21 11:27:59 2018 +0100

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

 doc/sphinx/source/.templates/download.html |   4 +-
 doc/sphinx/source/conf.py  |   3 +
 doc/sphinx/source/project/femdesc.rst  |   4 +-
 doc/sphinx/source/project/libdesc_cont.rst |   2 +-
 doc/sphinx/source/project/libdesc_gmm.rst  |   2 +-
 .../source/project/libdesc_high_gen_assemb.rst |   2 +-
 doc/sphinx/source/project/libdesc_mesh.rst |   4 +-
 doc/sphinx/source/tutorial/basic_usage.rst |   2 +-
 doc/sphinx/source/tutorial/install.rst |   6 +-
 doc/sphinx/source/tutorial/intro.rst   |   4 +-
 doc/sphinx/source/tutorial/thermo_coupling.rst |  53 ++-
 doc/sphinx/source/userdoc/appendixA.rst|   2 +-
 doc/sphinx/source/userdoc/appendixB.rst|   2 +-
 doc/sphinx/source/userdoc/gasm_high.rst|   1 +
 doc/sphinx/source/userdoc/gasm_low.rst |   4 +-
 doc/sphinx/source/userdoc/model_ALE_rotating.rst   |   4 +-
 doc/sphinx/source/userdoc/model_Mindlin_plate.rst  |   2 +-
 doc/sphinx/source/userdoc/model_Nitsche.rst|   2 +-
 doc/sphinx/source/userdoc/model_dirichlet.rst  |   2 +-
 .../source/userdoc/model_linear_elasticity.rst |   2 +-
 .../source/userdoc/model_time_integration.rst  |   2 +-
 interface/tests/python/check_levelset.py   |   2 +-
 interface/tests/python/demo_dynamic_contact_1D.py  |  38 +-
 .../tests/python/demo_large_sliding_contact.py |   2 +-
 interface/tests/python/demo_mortar.py  |   2 +-
 interface/tests/python/demo_plasticity.py  |   4 +-
 interface/tests/python/demo_stokes_3D_tank.py  |   4 +-
 interface/tests/python/demo_tripod.py  |   4 +-
 interface/tests/python/demo_tripod_alt.py  |   4 +-
 interface/tests/python/demo_wave.py|   4 +-
 interface/tests/python/getfem_tvtk.py  |  22 +-
 src/bgeot_poly_composite.cc|  59 ---
 src/getfem/bgeot_poly_composite.h  |  61 ++-
 src/getfem_import.cc   | 460 +++--
 34 files changed, 417 insertions(+), 358 deletions(-)



[Getfem-commits] [getfem-commits] branch consistent_partitioning_for_open_mp created (now df43516)

2018-12-21 Thread Andriy Andreykiv
andrico pushed a change to branch consistent_partitioning_for_open_mp.

at  df43516   Besides doing some basic clean up in the Open MP related 
partitioning and global storage the main purpose is to make region and 
subsequently assembly partitioning independent from the number of parallel 
threads being used. For instance, if we choose to partition the whole 
calculation into 8 partitions, but use only 2 parallel threads, then each 
thread will be looping through 4 independent partitions. This way, no matter 
how many threads we choose we partition the reg [...]

This branch includes the following new commits:

   new  407e1d8   Macro that encapsulates the parallel Open MP run
   new  059c201   Merge branch 'master' of git.sv.gnu.org:/srv/git/getfem 
into consistent_partitioning_for_open_mp
   new  df43516   Besides doing some basic clean up in the Open MP related 
partitioning and global storage the main purpose is to make region and 
subsequently assembly partitioning independent from the number of parallel 
threads being used. For instance, if we choose to partition the whole 
calculation into 8 partitions, but use only 2 parallel threads, then each 
thread will be looping through 4 independent partitions. This way, no matter 
how many threads we choose we partition the reg [...]




[Getfem-commits] [getfem-commits] comparing_global_objects_by_key updated (f56e01a -> e9270a8)

2018-11-09 Thread Andriy Andreykiv
andrico pushed a change to branch comparing_global_objects_by_key.

  from  f56e01a   comparing pconvex_structure by keys everywhere
   new  e9270a8   further refining comparison for convex_structure pointers


Summary of changes:
 src/bgeot_convex_structure.cc   | 26 ++
 src/getfem/bgeot_convex_structure.h | 17 -
 2 files changed, 34 insertions(+), 9 deletions(-)



[Getfem-commits] (no subject)

2018-11-08 Thread Andriy Andreykiv
branch: comparing_global_objects_by_key
commit f56e01a6e4dc6d488c3d25aa77f99f67a3b42cfa
Author: Andriy.Andreykiv 
Date:   Thu Nov 8 16:38:27 2018 +0100

comparing pconvex_structure by keys everywhere
---
 src/getfem/bgeot_convex_structure.h | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/getfem/bgeot_convex_structure.h 
b/src/getfem/bgeot_convex_structure.h
index 7632d18..5b4f659 100644
--- a/src/getfem/bgeot_convex_structure.h
+++ b/src/getfem/bgeot_convex_structure.h
@@ -154,6 +154,21 @@ namespace bgeot {
 friend pconvex_structure basic_structure(pconvex_structure cv);
   };
 
+  /**
+  *   Stored objects must be compared by keys, because there is a possibility 
that
+  *   they are duplicated in storages of multiple threads and pointers to them 
are
+  *   never equal
+  */
+  inline bool operator==(const pconvex_structure , const pconvex_structure 
)
+  {
+return *dal::key_of_stored_object(p1) == *dal::key_of_stored_object(p2);
+  }
+
+  inline bool operator!=(const pconvex_structure , const pconvex_structure 
)
+  {
+return !(p1 == p2);
+  }
+
   /// Original structure (if concerned)
   inline pconvex_structure basic_structure(pconvex_structure cv)
   { if (cv->auto_basic) return cv; else return cv->basic_pcvs; }
@@ -204,7 +219,7 @@ namespace bgeot {
   prism_structure(dim_type nc) { return prism_P1_structure(nc); }
   IS_DEPRECATED inline pconvex_structure
   pyramid_structure(short_type k) { return pyramid_QK_structure(k); }
-  
+
 
   /** Simplex structure with the Lagrange grid of degree k.
   @param n the simplex dimension.



[Getfem-commits] (no subject)

2018-10-31 Thread Andriy Andreykiv
branch: optimising_gmm_add_for_small_vectors
commit ab95e5c68c5e598d9a6d67e8402ba9eb3dc247c2
Author: Andriy.Andreykiv 
Date:   Wed Oct 31 12:54:06 2018 +0100

optimizing gmm::add for small vectors
---
 src/gmm/gmm_blas_interface.h | 45 +---
 1 file changed, 42 insertions(+), 3 deletions(-)

diff --git a/src/gmm/gmm_blas_interface.h b/src/gmm/gmm_blas_interface.h
index 8144293..f051c74 100644
--- a/src/gmm/gmm_blas_interface.h
+++ b/src/gmm/gmm_blas_interface.h
@@ -328,13 +328,52 @@ namespace gmm {
   /* * */
   /* add(x, y).*/
   /* * */
+  template
+  inline void add_fixed(const V1 , V2 )
+  {
+for(size_type i = 0; i != N; ++i) y[i] += x[i];
+  }
+
+  template
+  inline void add_for_short_vectors(const V1 , V2 , size_type n)
+  {
+switch(n)
+{
+  case  1: add_fixed<1>(x, y);  break;
+  case  2: add_fixed<2>(x, y);  break;
+  case  3: add_fixed<3>(x, y);  break;
+  case  4: add_fixed<4>(x, y);  break;
+  case  5: add_fixed<5>(x, y);  break;
+  case  6: add_fixed<6>(x, y);  break;
+  case  7: add_fixed<7>(x, y);  break;
+  case  8: add_fixed<8>(x, y);  break;
+  case  9: add_fixed<9>(x, y);  break;
+  case 10: add_fixed<10>(x, y); break;
+  case 11: add_fixed<11>(x, y); break;
+  case 12: add_fixed<12>(x, y); break;
+  case 13: add_fixed<13>(x, y); break;
+  case 14: add_fixed<14>(x, y); break;
+  case 15: add_fixed<15>(x, y); break;
+  case 16: add_fixed<16>(x, y); break;
+  case 17: add_fixed<17>(x, y); break;
+  case 18: add_fixed<18>(x, y); break;
+  case 19: add_fixed<19>(x, y); break;
+  case 20: add_fixed<20>(x, y); break;
+  case 21: add_fixed<21>(x, y); break;
+  case 22: add_fixed<22>(x, y); break;
+  case 23: add_fixed<23>(x, y); break;
+  case 24: add_fixed<24>(x, y); break;
+  default: GMM_ASSERT2(false, "add_for_short_vectors used with unsupported 
size"); break;
+}
+  }
 
 # define axpy_interface(param1, trans1, blas_name, base_type)  \
   inline void add(param1(base_type), std::vector ) { \
 GMMLAPACK_TRACE("axpy_interface"); \
-long inc(1), n(long(vect_size(y))); trans1(base_type);\
-if (n == 0) return;
   \
-blas_name(, , [0], , [0], );   \
+long inc(1), n(long(vect_size(y))); trans1(base_type); \
+if(n == 0) return; \
+else if(n < 25) add_for_short_vectors(x, y, n);\
+else blas_name(, , [0], , [0], );  \
   }
 
 # define axpy_p1(base_type) const std::vector 



[Getfem-commits] [getfem-commits] branch optimising_gmm_add_for_small_vectors created (now ab95e5c)

2018-10-31 Thread Andriy Andreykiv
andrico pushed a change to branch optimising_gmm_add_for_small_vectors.

at  ab95e5c   optimizing gmm::add for small vectors

This branch includes the following new commits:

   new  ab95e5c   optimizing gmm::add for small vectors




[Getfem-commits] (no subject)

2018-08-03 Thread Andriy Andreykiv
branch: comparing_stored_objects_by_key
commit 0722a459811b9579e4f288457ad7faa7a467be26
Author: aa 
Date:   Fri Aug 3 18:10:00 2018 +0200

readability improvements
---
 src/dal_static_stored_objects.cc | 23 ++-
 src/getfem/bgeot_convex.h|  7 ++-
 src/getfem/dal_naming_system.h   | 10 ++
 3 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/src/dal_static_stored_objects.cc b/src/dal_static_stored_objects.cc
index fef41c6..5080355 100644
--- a/src/dal_static_stored_objects.cc
+++ b/src/dal_static_stored_objects.cc
@@ -194,22 +194,19 @@ static bool dal_static_stored_tab_valid__ = true;
   pstatic_stored_object 
search_stored_object_on_all_threads(pstatic_stored_object_key k)
   {
 auto& stored_objects = singleton::instance();
-if (dal_static_stored_tab_valid__) {
-  auto p = stored_objects.search_stored_object(k);
+if (!dal_static_stored_tab_valid__) return nullptr;
+auto p = stored_objects.search_stored_object(k);
+if (p) return p;
+if (num_threads()  == 1) return nullptr;
+for(size_t thread = 0; thread < getfem::num_threads(); thread++)
+{
+  if (thread == this_thread()) continue;
+  auto& other_objects = singleton::instance(thread);
+  p = other_objects.search_stored_object(k);
   if (p) return p;
-  else if (num_threads() > 1){
-for(size_t thread = 0; thread < getfem::num_threads(); thread++)
-{
-  if (thread == this_thread()) continue;
-  auto& other_objects = singleton::instance(thread);
-  p = other_objects.search_stored_object(k);
-  if (p) return p;
-}
-  }
-  return nullptr;
 }
 return nullptr;
-  }
+   }
 
   std::pair 
iterators_of_object(
 pstatic_stored_object o)
diff --git a/src/getfem/bgeot_convex.h b/src/getfem/bgeot_convex.h
index 58adc3c..1b100a5 100644
--- a/src/getfem/bgeot_convex.h
+++ b/src/getfem/bgeot_convex.h
@@ -186,8 +186,7 @@ namespace bgeot {
 pconvex_structure p;
 bool compare(const static_stored_object_key ) const override {
   auto  = dynamic_cast(oo);
-  if (p < o.p) return true;
-  return false;
+  return p < o.p;
 }
 bool equal(const static_stored_object_key ) const override {
   auto  = dynamic_cast(oo);
@@ -195,9 +194,7 @@ namespace bgeot {
 
   auto pkey = dal::key_of_stored_object(p);
   auto poo_key = dal::key_of_stored_object(o.p);
-  if (*pkey != *poo_key) return false;
-
-  return true;
+  return *pkey == *poo_key;
 }
 special_convex_structure_key_(pconvex_structure pp) : p(pp) {}
   };
diff --git a/src/getfem/dal_naming_system.h b/src/getfem/dal_naming_system.h
index 9c66eb5..e06c1cc 100644
--- a/src/getfem/dal_naming_system.h
+++ b/src/getfem/dal_naming_system.h
@@ -90,13 +90,15 @@ namespace dal {
   std::string name;
 
   bool compare(const static_stored_object_key ) const override{
-auto  = dynamic_cast(oo);
-return name < o.name;
+ auto  = dynamic_cast(oo);
+ return name < o.name;
   }
+
   bool equal(const static_stored_object_key ) const override{
-auto  = dynamic_cast(oo);
-return name == o.name;
+ auto  = dynamic_cast(oo);
+ return name == o.name;
   }
+
   method_key(const std::string _) : name(name_) {}
 };
 



[Getfem-commits] (no subject)

2018-07-30 Thread Andriy Andreykiv
branch: comparing_stored_objects_by_key
commit 7085b857a93d0f58d6973402a3a2c482880f83b6
Author: aa 
Date:   Tue Jul 31 03:40:59 2018 +0200

two more overloads for equal
---
 src/bgeot_convex_ref.cc | 29 +++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/bgeot_convex_ref.cc b/src/bgeot_convex_ref.cc
index cc3dc59..e7b7c5e 100644
--- a/src/bgeot_convex_ref.cc
+++ b/src/bgeot_convex_ref.cc
@@ -150,7 +150,7 @@ namespace bgeot {
 
   struct stored_point_tab_key : virtual public dal::static_stored_object_key  {
 const stored_point_tab *pspt;
-virtual bool compare(const static_stored_object_key ) const {
+bool compare(const static_stored_object_key ) const override {
   const stored_point_tab_key 
 = dynamic_cast(oo);
   const stored_point_tab  = *pspt;
@@ -169,6 +169,23 @@ namespace bgeot {
   if (it2 != y.end()) return true;
   return false;
 }
+bool equal(const static_stored_object_key ) const override {
+  auto  = dynamic_cast(oo);
+  auto  = *pspt;
+  auto  = *(o.pspt);
+  if ( == ) return true;
+  if (x.size() != y.size()) return false;
+  auto it1 = x.begin();
+  auto it2 = y.begin();
+  base_node::const_iterator itn1, itn2, itne;
+  for ( ; it1 != x.end() && it2 != y.end() ; ++it1, ++it2) {
+if ((*it1).size() != (*it2).size()) return false;
+itn1 = (*it1).begin(); itne = (*it1).end(); itn2 = (*it2).begin();
+for ( ; itn1 != itne ; ++itn1, ++itn2)
+  if (*itn1 != *itn2) return false;
+  }
+  return true;
+}
 stored_point_tab_key(const stored_point_tab *p) : pspt(p) {}
   };
 
@@ -216,7 +233,7 @@ namespace bgeot {
   // 2 = dummy
 dim_type N; short_type K; short_type nf;
   public :
-virtual bool compare(const static_stored_object_key ) const {
+bool compare(const static_stored_object_key ) const override{
   const convex_of_reference_key 
 = dynamic_cast(oo);
   if (type < o.type) return true;
@@ -228,6 +245,14 @@ namespace bgeot {
   if (nf < o.nf) return true;
   return false;
 }
+bool equal(const static_stored_object_key ) const override{
+  auto  = dynamic_cast(oo);
+  if (type != o.type) return false;
+  if (N != o.N) return false;
+  if (K != o.K) return false;
+  if (nf != o.nf) return false;
+  return true;
+}
 convex_of_reference_key(int t, dim_type NN, short_type KK = 0,
 short_type nnf = 0)
   : type(t), N(NN), K(KK), nf(nnf) {}



[Getfem-commits] (no subject)

2018-07-30 Thread Andriy Andreykiv
branch: comparing_stored_objects_by_key
commit 012f127cb5e159d0e03ff4195fb70b85c40417a9
Author: aa 
Date:   Tue Jul 31 00:19:06 2018 +0200

- search_stored_object_on_all_threads
 - equal method for static keys
---
 src/dal_static_stored_objects.cc   | 20 
 src/getfem/dal_static_stored_objects.h | 29 +
 2 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/src/dal_static_stored_objects.cc b/src/dal_static_stored_objects.cc
index 67445b0..fef41c6 100644
--- a/src/dal_static_stored_objects.cc
+++ b/src/dal_static_stored_objects.cc
@@ -191,6 +191,26 @@ static bool dal_static_stored_tab_valid__ = true;
 return 0;
   }
 
+  pstatic_stored_object 
search_stored_object_on_all_threads(pstatic_stored_object_key k)
+  {
+auto& stored_objects = singleton::instance();
+if (dal_static_stored_tab_valid__) {
+  auto p = stored_objects.search_stored_object(k);
+  if (p) return p;
+  else if (num_threads() > 1){
+for(size_t thread = 0; thread < getfem::num_threads(); thread++)
+{
+  if (thread == this_thread()) continue;
+  auto& other_objects = singleton::instance(thread);
+  p = other_objects.search_stored_object(k);
+  if (p) return p;
+}
+  }
+  return nullptr;
+}
+return nullptr;
+  }
+
   std::pair 
iterators_of_object(
 pstatic_stored_object o)
   {
diff --git a/src/getfem/dal_static_stored_objects.h 
b/src/getfem/dal_static_stored_objects.h
index f8acb95..ce5b547 100644
--- a/src/getfem/dal_static_stored_objects.h
+++ b/src/getfem/dal_static_stored_objects.h
@@ -127,9 +127,8 @@ namespace dal {
 
   class static_stored_object_key {
   protected :
-virtual bool compare(const static_stored_object_key &) const {
-  GMM_ASSERT1(false, "This method should not be called");
-}
+virtual bool compare(const static_stored_object_key &) const = 0;
+virtual bool equal(const static_stored_object_key &) const = 0;
 
   public :
 bool operator < (const static_stored_object_key ) const {
@@ -139,18 +138,30 @@ namespace dal {
   return compare(o);
 }
 
-virtual ~static_stored_object_key() {}
+bool operator == (const static_stored_object_key ) const {
+  if (typeid(o)!=typeid(*this)) return false;
+  return equal(o);
+}
 
-  };
+bool operator != (const static_stored_object_key ) const {
+  return !(*this == o);
+}
 
+virtual ~static_stored_object_key() {}
+  };
 
   template 
   class simple_key : virtual public static_stored_object_key {
 var_type a;
   public :
-virtual bool compare(const static_stored_object_key ) const {
-  const simple_key  = dynamic_cast(oo);
-  return (a < o.a);
+ bool compare(const static_stored_object_key ) const override {
+  auto  = dynamic_cast(oo);
+  return a < o.a;
+}
+
+bool equal(const static_stored_object_key ) const override {
+  auto  = dynamic_cast(oo);
+  return a == o.a;
 }
 simple_key(var_type aa) : a(aa) {}
   };
@@ -208,6 +219,8 @@ namespace dal {
   /** Gives a pointer to an object from a key pointer. */
   pstatic_stored_object search_stored_object(pstatic_stored_object_key k);
 
+  pstatic_stored_object 
search_stored_object_on_all_threads(pstatic_stored_object_key k);
+
   /** Test if an object is stored*/
   bool exists_stored_object(pstatic_stored_object o);
 



[Getfem-commits] (no subject)

2018-07-30 Thread Andriy Andreykiv
branch: comparing_stored_objects_by_key
commit 79fb7ae312a6ebf4e954d1bf54e5f3747f74ff14
Author: aa 
Date:   Tue Jul 31 00:20:02 2018 +0200

overriding equal for method_key
---
 src/getfem/dal_naming_system.h | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/getfem/dal_naming_system.h b/src/getfem/dal_naming_system.h
index 71f1226..9c66eb5 100644
--- a/src/getfem/dal_naming_system.h
+++ b/src/getfem/dal_naming_system.h
@@ -89,9 +89,13 @@ namespace dal {
 struct method_key : virtual public static_stored_object_key {
   std::string name;
 
-  virtual bool compare(const static_stored_object_key ) const {
-   const method_key  = dynamic_cast(oo);
-   if (name < o.name) return true; else return false;
+  bool compare(const static_stored_object_key ) const override{
+auto  = dynamic_cast(oo);
+return name < o.name;
+  }
+  bool equal(const static_stored_object_key ) const override{
+auto  = dynamic_cast(oo);
+return name == o.name;
   }
   method_key(const std::string _) : name(name_) {}
 };



[Getfem-commits] (no subject)

2018-07-30 Thread Andriy Andreykiv
branch: comparing_stored_objects_by_key
commit e8a34a7b1912a64cbbe1187d08c522c4ba62f040
Author: aa 
Date:   Tue Jul 31 00:30:28 2018 +0200

override equal for special_convex_structure_key_
---
 src/getfem/bgeot_convex.h | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/getfem/bgeot_convex.h b/src/getfem/bgeot_convex.h
index 6021f38..58adc3c 100644
--- a/src/getfem/bgeot_convex.h
+++ b/src/getfem/bgeot_convex.h
@@ -184,12 +184,21 @@ namespace bgeot {
 
   struct special_convex_structure_key_ : virtual public 
dal::static_stored_object_key {
 pconvex_structure p;
-virtual bool compare(const static_stored_object_key ) const {
-  const special_convex_structure_key_ 
-= dynamic_cast(oo);
+bool compare(const static_stored_object_key ) const override {
+  auto  = dynamic_cast(oo);
   if (p < o.p) return true;
   return false;
 }
+bool equal(const static_stored_object_key ) const override {
+  auto  = dynamic_cast(oo);
+  if (p == o.p) return true;
+
+  auto pkey = dal::key_of_stored_object(p);
+  auto poo_key = dal::key_of_stored_object(o.p);
+  if (*pkey != *poo_key) return false;
+
+  return true;
+}
 special_convex_structure_key_(pconvex_structure pp) : p(pp) {}
   };
 



[Getfem-commits] (no subject)

2018-07-30 Thread Andriy Andreykiv
branch: comparing_stored_objects_by_key
commit 7e0a80acd34c4a79ccaa223abb589b1cd3ebd4cd
Author: aa 
Date:   Tue Jul 31 03:54:03 2018 +0200

not comparing the addresses of stored objects but their keys
---
 src/getfem_integration.cc | 3 ++-
 src/getfem_mesh_im.cc | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/getfem_integration.cc b/src/getfem_integration.cc
index 7131cc4..911a2b0 100644
--- a/src/getfem_integration.cc
+++ b/src/getfem_integration.cc
@@ -322,7 +322,8 @@ namespace getfem {
   short_type f) {
 papprox_integration pai = ppi->approx_method();
 GMM_ASSERT1(!valid, "Impossible to modify a valid integration method.");
-GMM_ASSERT1(pai->structure() == structure()->faces_structure()[f],
+GMM_ASSERT1(*key_of_stored_object(pai->structure())
+== *key_of_stored_object(structure()->faces_structure()[f]),
 "structures missmatch");
 GMM_ASSERT1(ppi->type() == IM_APPROX, "Impossible with an exact method.");
 
diff --git a/src/getfem_mesh_im.cc b/src/getfem_mesh_im.cc
index 1e4990c..14a3f3b 100644
--- a/src/getfem_mesh_im.cc
+++ b/src/getfem_mesh_im.cc
@@ -54,9 +54,9 @@ namespace getfem {
  { im_convexes.sup(cv); touch(); v_num = act_counter(); } }
 else if (!im_convexes.is_in(cv) || ims[cv] != pim) {
   GMM_ASSERT1
-   (pim->type() == IM_NONE || 
-basic_structure(linked_mesh_->structure_of_convex(cv))
-== pim->structure(),
+   (pim->type() == IM_NONE ||
+
*key_of_stored_object(basic_structure(linked_mesh_->structure_of_convex(cv)))
+== *key_of_stored_object(pim->structure()),
 "Incompatibility between integration method "
 << getfem::name_of_int_method(pim) << " and mesh element " <<
 bgeot::name_of_geometric_trans(linked_mesh_->trans_of_convex(cv)));



[Getfem-commits] [getfem-commits] branch fixing_compiler_error_in_gmm_def created (now 5b67e48)

2017-07-31 Thread Andriy Andreykiv
andrico pushed a change to branch fixing_compiler_error_in_gmm_def.

at  5b67e48   fixing compiler error caused by removing of a argument 
(the argument is still being used in GMM_ASSERT3 in every function)

This branch includes the following new commits:

   new  5b67e48   fixing compiler error caused by removing of a argument 
(the argument is still being used in GMM_ASSERT3 in every function)




[Getfem-commits] (no subject)

2017-07-31 Thread Andriy Andreykiv
branch: fixing_compiler_error_in_gmm_def
commit 5b67e4877e96476cea9cd75a1ab484d8098e3b91
Author: aa 
Date:   Mon Jul 31 13:51:36 2017 +0200

fixing compiler error caused by removing of a argument
(the argument is still being used in GMM_ASSERT3 in every function)
---
 src/gmm/gmm_def.h | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/gmm/gmm_def.h b/src/gmm/gmm_def.h
index c6b0390..fdd5bb6 100644
--- a/src/gmm/gmm_def.h
+++ b/src/gmm/gmm_def.h
@@ -923,22 +923,21 @@ namespace gmm {
   template  inline
   void set_to_end(IT &, ORG, const VECT *, linalg_const) { }
 
-
   template  inline
-  void set_to_begin(IT &, ORG, VECT *, linalg_modifiable)
-  { GMM_ASSERT3(!is_sparse(*v), "internal_error"); }
+  void set_to_begin(IT &, ORG, VECT *v, linalg_modifiable)
+  { GMM_ASSERT3(!is_sparse(*v), "internal_error"); v = 0; }
 
   template  inline
-  void set_to_begin(IT &, ORG, const VECT *, linalg_modifiable)
-  { GMM_ASSERT3(!is_sparse(*v), "internal_error"); }
+  void set_to_begin(IT &, ORG, const VECT *v, linalg_modifiable)
+  { GMM_ASSERT3(!is_sparse(*v), "internal_error"); v = 0; }
  
   template  inline
-  void set_to_end(IT &, ORG, VECT *, linalg_modifiable)
-  { GMM_ASSERT3(!is_sparse(*v), "internal_error"); }
+  void set_to_end(IT &, ORG, VECT *v, linalg_modifiable)
+  { GMM_ASSERT3(!is_sparse(*v), "internal_error"); v = 0; }
   
   template  inline
-  void set_to_end(IT &, ORG, const VECT *, linalg_modifiable)
-  { GMM_ASSERT3(!is_sparse(*v), "internal_error"); }
+  void set_to_end(IT &, ORG, const VECT *v, linalg_modifiable)
+  { GMM_ASSERT3(!is_sparse(*v), "internal_error"); v = 0; }
 
   /*  */
   /*   General index for certain algorithms. */



[Getfem-commits] (no subject)

2017-07-26 Thread Andriy Andreykiv
branch: fixing_binary_vtk_export
commit 4993fd92a4ff4bf8aef83b1ce760dfce5baad24c
Author: aa 
Date:   Wed Jul 26 14:50:31 2017 +0200

fixing writing binary files in vtk_export
---
 src/getfem_export.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/getfem_export.cc b/src/getfem_export.cc
index 18bfc73..14da099 100644
--- a/src/getfem_export.cc
+++ b/src/getfem_export.cc
@@ -63,7 +63,9 @@ namespace getfem
 : os(os_), ascii(ascii_) { init(); }
 
   vtk_export::vtk_export(const std::string& fname, bool ascii_)
-: os(real_os), ascii(ascii_), real_os(fname.c_str()) {
+: os(real_os), ascii(ascii_),
+real_os(fname.c_str(), !ascii ? std::ios_base::binary | std::ios_base::out 
:
+std::ios_base::out) {
 GMM_ASSERT1(real_os, "impossible to write to vtk file '" << fname << "'");
 init();
   }



[Getfem-commits] (no subject)

2017-07-26 Thread Andriy Andreykiv
branch: fixing_binary_vtk_export
commit de3f720b817640c6e358ce1d876495f15c449ce9
Author: aa 
Date:   Wed Jul 26 14:52:25 2017 +0200

moving three functions in vtk_export to protected classification
to make them accessible for derived classes
---
 src/getfem/getfem_export.h | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/getfem/getfem_export.h b/src/getfem/getfem_export.h
index 37a2df5..fb53aaf 100644
--- a/src/getfem/getfem_export.h
+++ b/src/getfem/getfem_export.h
@@ -78,6 +78,12 @@ namespace getfem {
 bool reverse_endian;
 enum { EMPTY, HEADER_WRITTEN, STRUCTURE_WRITTEN, IN_CELL_DATA,
IN_POINT_DATA } state;
+
+template void write_val(T v);
+template void write_vec(V p, size_type qdim);
+template void write_3x3tensor(IT p);
+void write_separ();
+
   public:
 typedef enum { VTK_VERTEX = 1,
VTK_LINE = 3,
@@ -136,7 +142,7 @@ namespace getfem {
 convex_index().card() elements.  */
 
 template void write_cell_data(const VECT& U,
-  const std::string& name, 
+  const std::string& name,
   size_type qdim = 1);
 /** export a data_set correspounding to measures of quality for each convex
 of the supplied mesh (which should have the same number of convex than
@@ -157,10 +163,6 @@ namespace getfem {
 void write_mesh_structure_from_mesh_fem();
 void switch_to_cell_data();
 void switch_to_point_data();
-template void write_val(T v);
-template void write_vec(V p, size_type qdim);
-template void write_3x3tensor(IT p);
-void write_separ();
 template void write_dataset_(const VECT& U,
  const std::string& name,
  size_type qdim,



  1   2   >