getfem-commits
[Top][All Lists]
Advanced

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

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


From: logari81
Subject: [Getfem-commits] r5261 - in /trunk/getfem: interface/src/ src/ src/getfem/
Date: Wed, 23 Mar 2016 12:03:13 -0000

Author: logari81
Date: Wed Mar 23 13:03:12 2016
New Revision: 5261

URL: http://svn.gna.org/viewcvs/getfem?rev=5261&view=rev
Log:
do not rely on the user for adding the interpolate_transformation_neighbour to 
a new workspace

Modified:
    trunk/getfem/interface/src/gf_asm.cc
    trunk/getfem/src/getfem/getfem_error_estimate.h
    trunk/getfem/src/getfem/getfem_generic_assembly.h
    trunk/getfem/src/getfem_generic_assembly.cc
    trunk/getfem/src/getfem_models.cc

Modified: trunk/getfem/interface/src/gf_asm.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/interface/src/gf_asm.cc?rev=5261&r1=5260&r2=5261&view=diff
==============================================================================
--- trunk/getfem/interface/src/gf_asm.cc        (original)
+++ trunk/getfem/interface/src/gf_asm.cc        Wed Mar 23 13:03:12 2016
@@ -423,7 +423,6 @@
   size_type region = in.pop().to_integer();
 
   getfem::ga_workspace workspace1;
-  add_interpolate_transformation_neighbour(workspace1);
   getfem::model dummy_md;
   bool with_model = in.remaining() && is_model_object(in.front());
   const getfem::model &md = with_model ? *to_model_object(in.pop()) : dummy_md;

Modified: trunk/getfem/src/getfem/getfem_error_estimate.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/getfem_error_estimate.h?rev=5261&r1=5260&r2=5261&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_error_estimate.h     (original)
+++ trunk/getfem/src/getfem/getfem_error_estimate.h     Wed Mar 23 13:03:12 2016
@@ -60,7 +60,6 @@
     const mesh_fem &mf0 = classical_mesh_fem(m, 0);
 
     getfem::ga_workspace workspace;
-    add_interpolate_transformation_neighbour(workspace);
     mesh_region inner_faces = inner_faces_of_mesh(m, rg);
     getfem::size_type nbdof = mf0.nb_dof();
     getfem::base_vector Z(nbdof);

Modified: trunk/getfem/src/getfem/getfem_generic_assembly.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/getfem_generic_assembly.h?rev=5261&r1=5260&r2=5261&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_generic_assembly.h   (original)
+++ trunk/getfem/src/getfem/getfem_generic_assembly.h   Wed Mar 23 13:03:12 2016
@@ -118,6 +118,8 @@
     const model *md;
     const ga_workspace *parent_workspace;
     bool enable_all_md_variables;
+
+    void init();
 
     struct var_description {
 
@@ -548,11 +550,14 @@
 
     ga_workspace(const getfem::model &md_, bool enable_all_variables = false)
       : md(&md_), parent_workspace(0),
-        enable_all_md_variables(enable_all_variables) {}
+        enable_all_md_variables(enable_all_variables)
+    { init(); }
     ga_workspace(bool, const ga_workspace &gaw)
-      : md(0), parent_workspace(&gaw), enable_all_md_variables(false) {}
+      : md(0), parent_workspace(&gaw), enable_all_md_variables(false)
+    { init(); }
     ga_workspace()
-      : md(0), parent_workspace(0), enable_all_md_variables(false) {}
+      : md(0), parent_workspace(0), enable_all_md_variables(false)
+    { init(); }
     ~ga_workspace() { clear_expressions(); }
 
   };
@@ -654,12 +659,12 @@
    const mesh &source_mesh, const mesh &target_mesh, const std::string &expr);
 
 
-  /** Add a transformation to the model `md` corresponding to the interpolation
-      on the neighbour element. Can only be applied to the computation on
-      some internal faces of a mesh.
+  /** Create a new instance of a transformation corresponding to the
+      interpolation on the neighbour element. Can only be applied to the
+      computation on some internal faces of a mesh.
+      (mainly for internal use in the constructor of getfem::model)
   */
-  void add_interpolate_transformation_neighbour(model &md);
-  void add_interpolate_transformation_neighbour(ga_workspace &workspace);
+  pinterpolate_transformation interpolate_transformation_neighbour_instance();
 
 }  /* end of namespace getfem.                                             */
 

Modified: trunk/getfem/src/getfem_generic_assembly.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem_generic_assembly.cc?rev=5261&r1=5260&r2=5261&view=diff
==============================================================================
--- trunk/getfem/src/getfem_generic_assembly.cc (original)
+++ trunk/getfem/src/getfem_generic_assembly.cc Wed Mar 23 13:03:12 2016
@@ -5213,6 +5213,12 @@
   // functions, operators.
   //=========================================================================
 
+  void ga_workspace::init() {
+    add_interpolate_transformation
+      ("neighbour_elt", interpolate_transformation_neighbour_instance());
+  }
+
+  // variables and variable groups
   void ga_workspace::add_fem_variable
   (const std::string &name, const mesh_fem &mf,
    const gmm::sub_interval &I, const model_real_plain_vector &VV) {
@@ -11680,17 +11686,13 @@
 
   };
 
-  // Should be added by default
-
-  void add_interpolate_transformation_neighbour(model &md) {
-    pinterpolate_transformation p(new interpolate_transformation_neighbour());
-    md.add_interpolate_transformation("neighbour_elt", p);
+
+  pinterpolate_transformation interpolate_transformation_neighbour_instance()
+  {
+    pinterpolate_transformation
+      p = std::make_shared<interpolate_transformation_neighbour>();
+    return p;
   }
 
-  void add_interpolate_transformation_neighbour(ga_workspace &workspace) {
-    pinterpolate_transformation p(new interpolate_transformation_neighbour());
-    workspace.add_interpolate_transformation("neighbour_elt", p);
-  }
-
 
 } /* end of namespace */

Modified: trunk/getfem/src/getfem_models.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem_models.cc?rev=5261&r1=5260&r2=5261&view=diff
==============================================================================
--- trunk/getfem/src/getfem_models.cc   (original)
+++ trunk/getfem/src/getfem_models.cc   Wed Mar 23 13:03:12 2016
@@ -92,7 +92,8 @@
     is_linear_ = is_symmetric_ = is_coercive_ = true;
     leading_dim = 0;
     time_integration = 0; init_step = false; time_step = scalar_type(1);
-    add_interpolate_transformation_neighbour(*this);
+    add_interpolate_transformation
+      ("neighbour_elt", interpolate_transformation_neighbour_instance());
   }
 
   void model::var_description::set_size(void) {
@@ -2810,19 +2811,22 @@
   }
 
 
-  const mesh_fem &model::mesh_fem_of_variable(const std::string &name) const {
+  const mesh_fem &
+  model::mesh_fem_of_variable(const std::string &name) const {
     VAR_SET::const_iterator it = variables.find(name);
     GMM_ASSERT1(it!=variables.end(), "Undefined variable " << name);
     return it->second.associated_mf();
   }
 
-  const mesh_fem *model::pmesh_fem_of_variable(const std::string &name) const {
+  const mesh_fem *
+  model::pmesh_fem_of_variable(const std::string &name) const {
     VAR_SET::const_iterator it = variables.find(name);
     GMM_ASSERT1(it!=variables.end(), "Undefined variable " << name);
     return it->second.passociated_mf();
   }
 
-  bgeot::multi_index model::qdims_of_variable(const std::string &name) const {
+  bgeot::multi_index
+  model::qdims_of_variable(const std::string &name) const {
     VAR_SET::const_iterator it = variables.find(name);
     GMM_ASSERT1(it!=variables.end(), "Undefined variable " << name);
     const mesh_fem *mf = it->second.passociated_mf();




reply via email to

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