getfem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Getfem-commits] r5146 - in /trunk/getfem: interface/src/ src/ src/getfe


From: Yves . Renard
Subject: [Getfem-commits] r5146 - in /trunk/getfem: interface/src/ src/ src/getfem/ tests/
Date: Thu, 19 Nov 2015 17:01:20 -0000

Author: renard
Date: Thu Nov 19 18:01:20 2015
New Revision: 5146

URL: http://svn.gna.org/viewcvs/getfem?rev=5146&view=rev
Log:
changes in dynamic allocation

Modified:
    trunk/getfem/interface/src/getfemint_misc.cc
    trunk/getfem/interface/src/getfemint_misc.h
    trunk/getfem/interface/src/gf_model_get.cc
    trunk/getfem/src/getfem/getfem_mesher.h
    trunk/getfem/src/getfem/getfem_plasticity.h
    trunk/getfem/src/getfem_plasticity.cc
    trunk/getfem/tests/plasticity.cc

Modified: trunk/getfem/interface/src/getfemint_misc.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/interface/src/getfemint_misc.cc?rev=5146&r1=5145&r2=5146&view=diff
==============================================================================
--- trunk/getfem/interface/src/getfemint_misc.cc        (original)
+++ trunk/getfem/interface/src/getfemint_misc.cc        Thu Nov 19 18:01:20 2015
@@ -783,9 +783,10 @@
 
 
   /** This function return the right projection type chosen which could only 
be for the moment the Von Mises projection. */
-  const getfem::abstract_constraints_projection 
&abstract_constraints_projection_from_name(const std::string &projname) {
-
-    static getfem::VM_projection VM_proj(0);
+  const getfem::pconstraints_projection 
&abstract_constraints_projection_from_name(const std::string &projname) {
+
+    static getfem::pconstraints_projection
+      VM_proj = std::shared_ptr<getfem::VM_projection>(0);
 
     if (cmd_strmatch(projname, "Von Mises") ||
         cmd_strmatch(projname, "VM")) return VM_proj;

Modified: trunk/getfem/interface/src/getfemint_misc.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/interface/src/getfemint_misc.h?rev=5146&r1=5145&r2=5146&view=diff
==============================================================================
--- trunk/getfem/interface/src/getfemint_misc.h (original)
+++ trunk/getfem/interface/src/getfemint_misc.h Thu Nov 19 18:01:20 2015
@@ -42,6 +42,7 @@
 
 namespace getfem {
   class abstract_constraints_projection;
+  typedef std::shared_ptr<const abstract_constraints_projection> 
pconstraints_projection;
 }
 
 namespace getfemint {
@@ -76,7 +77,7 @@
   const getfem::phyperelastic_law &abstract_hyperelastic_law_from_name(const 
std::string &lawname, size_type N);
 
 
-  const getfem::abstract_constraints_projection 
&abstract_constraints_projection_from_name(const std::string &projname);
+  const getfem::pconstraints_projection 
&abstract_constraints_projection_from_name(const std::string &projname);
 
 
   class interruptible_iteration : public gmm::iteration {

Modified: trunk/getfem/interface/src/gf_model_get.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/interface/src/gf_model_get.cc?rev=5146&r1=5145&r2=5146&view=diff
==============================================================================
--- trunk/getfem/interface/src/gf_model_get.cc  (original)
+++ trunk/getfem/interface/src/gf_model_get.cc  Thu Nov 19 18:01:20 2015
@@ -875,8 +875,8 @@
 
        getfem::elastoplasticity_next_iter
        (md->model(), gfi_mim->mesh_im(), varname,
-          abstract_constraints_projection_from_name(projname),
-          datalambda, datamu, datathreshold, datasigma);
+       abstract_constraints_projection_from_name(projname),
+       datalambda, datamu, datathreshold, datasigma);
        );
 
 
@@ -899,7 +899,7 @@
        getfem::model_real_plain_vector plast((gfi_mf->mesh_fem()).nb_dof());
        getfem::compute_plastic_part
        (md->model(), gfi_mim->mesh_im(),  gfi_mf->mesh_fem(), varname,
-          abstract_constraints_projection_from_name(projname),
+       abstract_constraints_projection_from_name(projname),
         datalambda, datamu, datathreshold, datasigma, plast);
        out.pop().from_dcvector(plast);
        );

Modified: trunk/getfem/src/getfem/getfem_mesher.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/getfem_mesher.h?rev=5146&r1=5145&r2=5146&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_mesher.h     (original)
+++ trunk/getfem/src/getfem/getfem_mesher.h     Thu Nov 19 18:01:20 2015
@@ -32,7 +32,7 @@
 /address@hidden getfem_mesher.h
    @author  Julien Pommier <address@hidden>, Yves Renard <address@hidden>
    @date May 1, 2004.
-   @brief a broken mesher.
+   @brief An experimental mesher.
 */
 
 #ifndef GETFEM_MESHER_H__
@@ -83,6 +83,8 @@
                                      mesher_signed_distance*>& list) const=0;
     virtual scalar_type operator()(const base_node &P) const  = 0;
   };
+
+  typedef std::shared_ptr<const mesher_signed_distance> 
pmesher_signed_distance;
 
   class mesher_half_space : public mesher_signed_distance {
     base_node x0; base_small_vector n; scalar_type xon;

Modified: trunk/getfem/src/getfem/getfem_plasticity.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/getfem_plasticity.h?rev=5146&r1=5145&r2=5146&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_plasticity.h (original)
+++ trunk/getfem/src/getfem/getfem_plasticity.h Thu Nov 19 18:01:20 2015
@@ -74,7 +74,8 @@
     virtual ~abstract_constraints_projection () {}
   };
 
-
+  typedef std::shared_ptr<const abstract_constraints_projection>
+  pconstraints_projection;
 
   //=================================================================
   // Von Mises projection
@@ -259,7 +260,7 @@
   size_type add_elastoplasticity_brick
   (model &md,
    const mesh_im &mim,
-   const abstract_constraints_projection &ACP,
+   const pconstraints_projection &ACP,
    const std::string &varname,
    const std::string &datalambda,
    const std::string &datamu,
@@ -283,7 +284,7 @@
   void elastoplasticity_next_iter(model &md,
                                   const mesh_im &mim,
                                   const std::string &varname,
-                                  const abstract_constraints_projection &ACP,
+                                  const pconstraints_projection &ACP,
                                   const std::string &datalambda,
                                   const std::string &datamu,
                                   const std::string &datathreshold,
@@ -314,7 +315,7 @@
                             const mesh_im &mim,
                             const mesh_fem &mf_pl,
                             const std::string &varname,
-                            const abstract_constraints_projection &ACP,
+                            const pconstraints_projection &ACP,
                             const std::string &datalambda,
                             const std::string &datamu,
                             const std::string &datathreshold,

Modified: trunk/getfem/src/getfem_plasticity.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem_plasticity.cc?rev=5146&r1=5145&r2=5146&view=diff
==============================================================================
--- trunk/getfem/src/getfem_plasticity.cc       (original)
+++ trunk/getfem/src/getfem_plasticity.cc       Thu Nov 19 18:01:20 2015
@@ -412,7 +412,7 @@
 
   struct elastoplasticity_brick : public virtual_brick {
 
-    const abstract_constraints_projection  &t_proj;
+    pconstraints_projection  t_proj;
 
     virtual void asm_real_tangent_terms(const model &md,
                                         size_type /* ib */,
@@ -459,7 +459,7 @@
         gmm::clear(matl[0]);
         asm_elastoplasticity_tangent_matrix
           (matl[0], mim, mf_u, mf_sigma, *mf_data, u_n,
-           u_np1, sigma_n, lambda, mu, threshold, t_proj, rg);
+           u_np1, sigma_n, lambda, mu, threshold, *t_proj, rg);
       }
 
       if (version & model::BUILD_RHS) {
@@ -467,14 +467,14 @@
         asm_elastoplasticity_rhs(vecl[0], dummy,
                                  mim, mf_u, mf_sigma, *mf_data,
                                  u_n, u_np1, sigma_n,
-                                 lambda, mu, threshold, t_proj, PROJ, rg);
+                                 lambda, mu, threshold, *t_proj, PROJ, rg);
         gmm::scale(vecl[0], scalar_type(-1));
       }
 
     }
 
     // constructor
-    elastoplasticity_brick(const abstract_constraints_projection &t_proj_)
+    elastoplasticity_brick(const pconstraints_projection &t_proj_)
       : t_proj(t_proj_) {
       set_flags("Elastoplasticity brick", false /* is linear*/,
                 true /* is symmetric */, false /* is coercive */,
@@ -491,7 +491,7 @@
   size_type add_elastoplasticity_brick
     (model &md,
      const mesh_im &mim,
-     const abstract_constraints_projection &ACP,
+     const pconstraints_projection &ACP,
      const std::string &varname,
      const std::string &datalambda,
      const std::string &datamu,
@@ -524,7 +524,7 @@
   void elastoplasticity_next_iter(model &md,
                                   const mesh_im &mim,
                                   const std::string &varname,
-                                  const abstract_constraints_projection &ACP,
+                                  const pconstraints_projection &ACP,
                                   const std::string &datalambda,
                                   const std::string &datamu,
                                   const std::string &datathreshold,
@@ -551,7 +551,7 @@
     asm_elastoplasticity_rhs(dummyV, &sigma_np1,
                              mim, mf_u, mf_sigma, *mf_data,
                              u_n, u_np1, sigma_n,
-                             lambda, mu, threshold, ACP, PROJ, rg);
+                             lambda, mu, threshold, *ACP, PROJ, rg);
 
     // upload sigma and u : u_np1 -> u_n, sigma_np1 -> sigma_n
     // be careful to use this function
@@ -626,7 +626,7 @@
                             const mesh_im &mim,
                             const mesh_fem &mf_pl,
                             const std::string &varname,
-                            const abstract_constraints_projection &ACP,
+                            const pconstraints_projection &ACP,
                             const std::string &datalambda,
                             const std::string &datamu,
                             const std::string &datathreshold,
@@ -654,7 +654,7 @@
     asm_elastoplasticity_rhs(dummyV, &saved_plast,
                              mim, mf_u, mf_sigma, *pmf_data,
                              u_n, u_np1, sigma_n,
-                             lambda, mu, threshold, ACP, PLAST, rg);
+                             lambda, mu, threshold, *ACP, PLAST, rg);
 
     /* Retrieve and save the plastic part */
     GMM_ASSERT1(gmm::vect_size(plast) == mf_pl.nb_dof(),

Modified: trunk/getfem/tests/plasticity.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/tests/plasticity.cc?rev=5146&r1=5145&r2=5146&view=diff
==============================================================================
--- trunk/getfem/tests/plasticity.cc    (original)
+++ trunk/getfem/tests/plasticity.cc    Thu Nov 19 18:01:20 2015
@@ -286,10 +286,10 @@
   model.add_fem_data("sigma", mf_sigma);
 
   /* choose the projection type */
-  getfem::abstract_constraints_projection *proj = 0;
-  proj = new getfem::VM_projection(0);
-
-  add_elastoplasticity_brick(model, mim, *proj, "u", "lambda", "mu", 
+  getfem::pconstraints_projection
+    proj = std::make_shared<getfem::VM_projection>(0);
+
+  add_elastoplasticity_brick(model, mim, proj, "u", "lambda", "mu", 
                             "s", "sigma");
   
   plain_vector F(nb_dof_rhs * N);
@@ -342,7 +342,7 @@
  
     //compute and save sigma_np1
     //    getfem::mesh_fem *mf_data=0;
-    getfem::elastoplasticity_next_iter(model, mim, "u", *proj, 
+    getfem::elastoplasticity_next_iter(model, mim, "u", proj, 
                        "lambda", "mu", "s", "sigma");
     
     // Get the solution and save it




reply via email to

[Prev in Thread] Current Thread [Next in Thread]