[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Getfem-commits] r5489 - in /trunk/getfem: contrib/xfem_contact/ src/ sr
From: |
Yves . Renard |
Subject: |
[Getfem-commits] r5489 - in /trunk/getfem: contrib/xfem_contact/ src/ src/getfem/ |
Date: |
Tue, 29 Nov 2016 17:20:10 -0000 |
Author: renard
Date: Tue Nov 29 18:20:08 2016
New Revision: 5489
URL: http://svn.gna.org/viewcvs/getfem?rev=5489&view=rev
Log:
adding a transformation for extrapolation on neigbhour elements
Modified:
trunk/getfem/contrib/xfem_contact/xfem_dirichlet.cc
trunk/getfem/src/getfem/getfem_generic_assembly.h
trunk/getfem/src/getfem_generic_assembly.cc
Modified: trunk/getfem/contrib/xfem_contact/xfem_dirichlet.cc
URL:
http://svn.gna.org/viewcvs/getfem/trunk/getfem/contrib/xfem_contact/xfem_dirichlet.cc?rev=5489&r1=5488&r2=5489&view=diff
==============================================================================
--- trunk/getfem/contrib/xfem_contact/xfem_dirichlet.cc (original)
+++ trunk/getfem/contrib/xfem_contact/xfem_dirichlet.cc Tue Nov 29 18:20:08 2016
@@ -882,7 +882,7 @@
//cout<<"vwgt="<<vwgt<<endl;
scalar_type ratio_size = PARAM.real_value("RATIO_GR_MESH", "ratio size
between mesh and patches");
- cout<<"ratio size beween mesh and coarse mesh= "<< ratio_size <<endl;
+ cout<<"ratio size between mesh and coarse mesh= "<< ratio_size <<endl;
int nparts = 1;
#if GETFEM_HAVE_METIS
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=5489&r1=5488&r2=5489&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_generic_assembly.h (original)
+++ trunk/getfem/src/getfem/getfem_generic_assembly.h Tue Nov 29 18:20:08 2016
@@ -653,6 +653,36 @@
*/
pinterpolate_transformation interpolate_transformation_neighbour_instance();
+ /* Add a special interpolation transformation which represents the identity
+ transformation but allows to evaluate the expression on another element
+ than the current element by polynomial extrapolation. It is used for
+ stabilization term in fictitious domain applications. the map elt_cor
+ list the element concerned by the transformation and associate them
+ to the element on which the extrapolation has to be made. If an element
+ is not listed in elt_cor the evaluation i just made on the current
element.
+ */
+ void add_interpolate_transformation_element_extrapolation
+ (model &md, const std::string &name, const mesh &sm,
+ std::map<size_type, size_type> &elt_corr);
+
+ void add_interpolate_transformation_element_extrapolation
+ (ga_workspace &workspace, const std::string &name, const mesh &sm,
+ std::map<size_type, size_type> &elt_corr);
+
+ /* Change the correspondance map of an element extrapolation interpolate
+ transformation.
+ */
+ void set_element_extrapolation_correspondance
+ (model &md, const std::string &name,
+ std::map<size_type, size_type> &elt_corr);
+
+ void set_element_extrapolation_correspondance
+ (ga_workspace &workspace, const std::string &name,
+ std::map<size_type, size_type> &elt_corr);
+
+
+
+
} /* 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=5489&r1=5488&r2=5489&view=diff
==============================================================================
--- trunk/getfem/src/getfem_generic_assembly.cc (original)
+++ trunk/getfem/src/getfem_generic_assembly.cc Tue Nov 29 18:20:08 2016
@@ -14179,5 +14179,114 @@
return p;
}
+ //=========================================================================
+ // Interpolate transformation on neighbour element (for extrapolation)
+ //=========================================================================
+
+ class interpolate_transformation_element_extrapolation
+ : public virtual_interpolate_transformation, public context_dependencies {
+
+ const mesh &sm;
+ std::map<size_type, size_type> elt_corr;
+
+ public:
+ void update_from_context() const {}
+ void extract_variables(const ga_workspace &/* workspace */,
+ std::set<var_trans_pair> &/* vars */,
+ bool /* ignore_data */, const mesh &/* m */,
+ const std::string &/* interpolate_name */) const {}
+ void init(const ga_workspace &/* workspace */) const {}
+ void finalize() const {}
+
+ int transform(const ga_workspace &/*workspace*/, const mesh &m_x,
+ fem_interpolation_context &ctx_x,
+ const base_small_vector &/*Normal*/, const mesh **m_t,
+ size_type &cv, short_type &face_num,
+ base_node &P_ref,
+ base_small_vector &/*N_y*/,
+ std::map<var_trans_pair, base_tensor> &/*derivatives*/,
+ bool compute_derivatives) const {
+
+ int ret_type = 0;
+ *m_t = &m_x;
+ GMM_ASSERT1(&sm == &m_x, "Bad mesh");
+ size_type cv_x = ctx_x.convex_num(), cv_y = cv_x;
+ auto it = elt_corr.find(cv_x);
+ if (it != elt_corr.end()) cv_y = it->second;
+
+ if (cv_x != cv_y) {
+ bgeot::geotrans_inv_convex gic;
+ gic.init(m_x.points_of_convex(cv_y),
+ m_x.trans_of_convex(cv_y));
+ bool converged = true;
+ gic.invert(ctx_x.xreal(), P_ref, converged, 1E-4);
+ GMM_ASSERT1(converged, "Geometric transformation inversion "
+ "has failed in element extrapolation transformation");
+ face_num = short_type(-1);
+ cv = cv_y;
+ ret_type = 1;
+ } else {
+ cv = cv_x;
+ P_ref = ctx_x.xref();
+ ret_type = 1;
+ }
+ GMM_ASSERT1(!compute_derivatives,
+ "No derivative for this transformation");
+ return ret_type;
+ }
+
+ void set_correspondance(const std::map<size_type, size_type> &ec) {
+ elt_corr = ec;
+ }
+
+ interpolate_transformation_element_extrapolation
+ (const mesh &sm_, const std::map<size_type, size_type> &ec)
+ : sm(sm_), elt_corr(ec) { }
+ };
+
+
+ void add_interpolate_transformation_element_extrapolation
+ (model &md, const std::string &name, const mesh &sm,
+ std::map<size_type, size_type> &elt_corr) {
+ pinterpolate_transformation
+ p = std::make_shared<interpolate_transformation_element_extrapolation>
+ (sm, elt_corr);
+ md.add_interpolate_transformation(name, p);
+ }
+
+ void add_interpolate_transformation_element_extrapolation
+ (ga_workspace &workspace, const std::string &name, const mesh &sm,
+ std::map<size_type, size_type> &elt_corr) {
+ pinterpolate_transformation
+ p = std::make_shared<interpolate_transformation_element_extrapolation>
+ (sm, elt_corr);
+ workspace.add_interpolate_transformation(name, p);
+ }
+
+ void set_element_extrapolation_correspondance
+ (ga_workspace &workspace, const std::string &name,
+ std::map<size_type, size_type> &elt_corr) {
+ GMM_ASSERT1(workspace.interpolate_transformation_exists(name),
+ "Unknown transformation");
+ auto pit=workspace.interpolate_transformation(name).get();
+ auto cpext
+ = dynamic_cast<const interpolate_transformation_element_extrapolation *>
+ (pit);
+ const_cast<interpolate_transformation_element_extrapolation *>(cpext)
+ ->set_correspondance(elt_corr);
+ }
+
+ void set_element_extrapolation_correspondance
+ (model &md, const std::string &name,
+ std::map<size_type, size_type> &elt_corr) {
+ GMM_ASSERT1(md.interpolate_transformation_exists(name),
+ "Unknown transformation");
+ auto pit=md.interpolate_transformation(name).get();
+ auto cpext
+ = dynamic_cast<const interpolate_transformation_element_extrapolation *>
+ (pit);
+ const_cast<interpolate_transformation_element_extrapolation *>(cpext)
+ ->set_correspondance(elt_corr);
+ }
} /* end of namespace */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Getfem-commits] r5489 - in /trunk/getfem: contrib/xfem_contact/ src/ src/getfem/,
Yves . Renard <=