[Getfem-commits] [getfem-commits] branch devel-tetsuo-fix-export-vtu updated: Fix the expression of for loop

2020-12-27 Thread Tetsuo Koyama
This is an automated email from the git hooks/post-receive script.

tkoyama010 pushed a commit to branch devel-tetsuo-fix-export-vtu
in repository getfem.

The following commit(s) were added to refs/heads/devel-tetsuo-fix-export-vtu by 
this push:
 new 8bf16b3  Fix the expression of for loop
8bf16b3 is described below

commit 8bf16b32a6e65b07d39ebc3af0b1b1f448c20cca
Author: Tetsuo Koyama 
AuthorDate: Mon Dec 28 09:31:47 2020 +0900

Fix the expression of for loop
---
 src/getfem_export.cc | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/getfem_export.cc b/src/getfem_export.cc
index ab331de..d83950c 100644
--- a/src/getfem_export.cc
+++ b/src/getfem_export.cc
@@ -479,8 +479,7 @@ namespace getfem
 for (size_type ic=0; ic < psl->nb_convex(); ++ic) {
   const getfem::mesh_slicer::cs_simplexes_ct& s = psl->simplexes(ic);
   for (const auto  : s)
-for (size_type j=0; j < val.dim()+1; ++j)
-  size += int(sizeof(int));
+size += int((val.dim()+1)*sizeof(int));
 }
 write_val(size);
   }
@@ -509,8 +508,7 @@ namespace getfem
 int size = 0;
 for (size_type ic=0; ic < psl->nb_convex(); ++ic) {
   const getfem::mesh_slicer::cs_simplexes_ct& s = psl->simplexes(ic);
-  for (const auto  : s)
-size += int(sizeof(int));
+  size += int(s.size()*sizeof(int));
 }
 write_val(size);
   }



[Getfem-commits] (no subject)

2020-12-27 Thread Tetsuo Koyama
branch: devel-tetsuo-fix-export-vtu
commit 2d3812300b9be7d0587dcac30d7feb73b187a126
Author: Tetsuo Koyama 
AuthorDate: Sun Dec 27 20:02:44 2020 +0900

Fix empty response error of export vtu
---
 ...ty_finite_strain_linear_hardening_tension_3D.py |   4 +-
 ...strain_linear_hardening_tension_axisymmetric.py |   4 +-
 ...strain_linear_hardening_tension_plane_strain.py |   4 +-
 interface/tests/python/check_export_vtu.py | 120 +
 src/getfem/getfem_export.h |   4 +-
 src/getfem_export.cc   |  44 ++--
 6 files changed, 145 insertions(+), 35 deletions(-)

diff --git 
a/contrib/continuum_mechanics/plasticity_finite_strain_linear_hardening_tension_3D.py
 
b/contrib/continuum_mechanics/plasticity_finite_strain_linear_hardening_tension_3D.py
index f041500..bd5eca9 100644
--- 
a/contrib/continuum_mechanics/plasticity_finite_strain_linear_hardening_tension_3D.py
+++ 
b/contrib/continuum_mechanics/plasticity_finite_strain_linear_hardening_tension_3D.py
@@ -128,7 +128,7 @@ if dH > 0:
   pts[2,i] -= (z*dH)/(2*H) * (1 + np.cos(2.*np.pi*x/L))
mesh.set_pts(pts)
 
-mesh.export_to_vtk("%s/mesh.vtk" % resultspath)
+mesh.export_to_vtu("%s/mesh.vtu" % resultspath)
 
 # FEM
 mfN = gf.MeshFem(mesh, N)
@@ -238,7 +238,7 @@ with open("%s/tension_3D.dat" % resultspath, "w") as f1:
 mfu, md.variable("u"), "Displacements",
 mfout2, md.interpolation("dirmult", mfout2, XP_RG), "Nominal 
reaction traction",
 mfout2, md.local_projection(mim, "gamma", mfout2), "plastic 
strain")
-  mfout2.export_to_vtk("%s/tension_3D_%i.vtk" % (resultspath, step), 
*output)
+  mfout2.export_to_vtu("%s/tension_3D_%i.vtu" % (resultspath, step), 
*output)
 
   md.set_variable("gamma0", md.interpolation("gamma", mimd1, -1))
   md.set_variable("invCp0vec",
diff --git 
a/contrib/continuum_mechanics/plasticity_finite_strain_linear_hardening_tension_axisymmetric.py
 
b/contrib/continuum_mechanics/plasticity_finite_strain_linear_hardening_tension_axisymmetric.py
index 8fc92ae..5ee76d8 100644
--- 
a/contrib/continuum_mechanics/plasticity_finite_strain_linear_hardening_tension_axisymmetric.py
+++ 
b/contrib/continuum_mechanics/plasticity_finite_strain_linear_hardening_tension_axisymmetric.py
@@ -119,7 +119,7 @@ if dH > 0:
   pts[1,i] -= (y*dH)/(2*H) * (1 + np.cos(2.*np.pi*x/L))
mesh.set_pts(pts)
 
-mesh.export_to_vtk("%s/mesh.vtk" % resultspath)
+mesh.export_to_vtu("%s/mesh.vtu" % resultspath)
 
 # FEM
 mfN = gf.MeshFem(mesh, N)
@@ -227,7 +227,7 @@ with open("%s/tension_axisymmetric.dat" % resultspath, "w") 
as f1:
 mfu, md.variable("u"), "Displacements",
 mfout2, md.interpolation("dirmult", mfout2, XP_RG), "Nominal 
reaction traction",
 mfout2, md.local_projection(mim, "gamma", mfout2), "plastic 
strain")
-  mfout2.export_to_vtk("%s/tension_axisymmetric_%i.vtk" % (resultspath, 
step), *output)
+  mfout2.export_to_vtu("%s/tension_axisymmetric_%i.vtu" % (resultspath, 
step), *output)
 
   md.set_variable("gamma0", md.interpolation("gamma", mimd1, -1))
   md.set_variable("invCp0vec",
diff --git 
a/contrib/continuum_mechanics/plasticity_finite_strain_linear_hardening_tension_plane_strain.py
 
b/contrib/continuum_mechanics/plasticity_finite_strain_linear_hardening_tension_plane_strain.py
index 422efe1..af489fd 100644
--- 
a/contrib/continuum_mechanics/plasticity_finite_strain_linear_hardening_tension_plane_strain.py
+++ 
b/contrib/continuum_mechanics/plasticity_finite_strain_linear_hardening_tension_plane_strain.py
@@ -118,7 +118,7 @@ if dH > 0:
   pts[1,i] -= (y*dH)/(2*H) * (1 + np.cos(2.*np.pi*x/L))
mesh.set_pts(pts)
 
-mesh.export_to_vtk("%s/mesh.vtk" % resultspath)
+mesh.export_to_vtu("%s/mesh.vtu" % resultspath)
 
 # FEM
 mfN = gf.MeshFem(mesh, N)
@@ -225,7 +225,7 @@ with open("%s/tension_plane_strain.dat" % resultspath, "w") 
as f1:
 mfu, md.variable("u"), "Displacements",
 mfout2, md.interpolation("dirmult", mfout2, XP_RG), "Nominal 
reaction traction",
 mfout2, md.local_projection(mim, "gamma", mfout2), "plastic 
strain")
-  mfout2.export_to_vtk("%s/tension_plane_strain_%i.vtk" % (resultspath, 
step), *output)
+  mfout2.export_to_vtu("%s/tension_plane_strain_%i.vtu" % (resultspath, 
step), *output)
 
   md.set_variable("gamma0", md.interpolation("gamma", mimd1, -1))
   md.set_variable("invCp0vec",
diff --git a/interface/tests/python/check_export_vtu.py 
b/interface/tests/python/check_export_vtu.py
index d6c45f9..0f20332 100644
--- a/interface/tests/python/check_export_vtu.py
+++ b/interface/tests/python/check_export_vtu.py
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 # Python GetFEM interface
 #
-# Copyright (C) 2004-2020 Yves Renard, Julien Pommier.
+# Copyright (C) 2020-2020 Tetsuo Koyama.
 #
 # This file is a part of GetFEM
 #
@@ -29,6 +29,7 @@
 import getfem as gf
 

[Getfem-commits] [getfem-commits] branch devel-tetsuo-fix-export-vtu created (now 2d38123)

2020-12-27 Thread Tetsuo Koyama
tkoyama010 pushed a change to branch devel-tetsuo-fix-export-vtu.

  at 2d38123  Fix empty response error of export vtu

This branch includes the following new commits:

 new 2d38123  Fix empty response error of export vtu