[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Getfem-commits] (no subject)
From: |
Konstantinos Poulios |
Subject: |
[Getfem-commits] (no subject) |
Date: |
Fri, 7 Sep 2018 14:08:43 -0400 (EDT) |
branch: merge-mesh-feature
commit b56a63161072efa69d796faf60109c7f2cdeea3a
Author: Konstantinos Poulios <address@hidden>
Date: Fri Sep 7 12:47:08 2018 +0200
Minor changes and substitute remove_duplicate_nodes option by passing a
negative radius value
---
src/bgeot_convex_ref.cc | 2 +-
src/bgeot_convex_structure.cc | 2 +-
src/bgeot_node_tab.cc | 8 ++++----
src/getfem/bgeot_mesh.h | 5 ++---
src/getfem/bgeot_node_tab.h | 10 +++++-----
src/getfem/getfem_projected_fem.h | 8 ++++----
src/getfem_generic_assembly_semantic.cc | 14 +++++++-------
src/getfem_import.cc | 5 +++--
src/getfem_projected_fem.cc | 2 +-
9 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/src/bgeot_convex_ref.cc b/src/bgeot_convex_ref.cc
index 1c94182..a903242 100644
--- a/src/bgeot_convex_ref.cc
+++ b/src/bgeot_convex_ref.cc
@@ -229,7 +229,7 @@ namespace bgeot {
// 2 = dummy
dim_type N; short_type K; short_type nf;
public :
- bool compare(const static_stored_object_key &oo) const override{
+ bool compare(const static_stored_object_key &oo) const override {
const convex_of_reference_key &o
= dynamic_cast<const convex_of_reference_key &>(oo);
if (type < o.type) return true;
diff --git a/src/bgeot_convex_structure.cc b/src/bgeot_convex_structure.cc
index fe927e9..e8ece95 100644
--- a/src/bgeot_convex_structure.cc
+++ b/src/bgeot_convex_structure.cc
@@ -83,7 +83,7 @@ namespace bgeot {
// 2 = dummy (N = dimension, K = nbpt)
dim_type N; short_type K; short_type nf;
public :
- bool compare(const static_stored_object_key &oo) const override{
+ bool compare(const static_stored_object_key &oo) const override {
const convex_structure_key &o
= dynamic_cast<const convex_structure_key &>(oo);
if (type < o.type) return true;
diff --git a/src/bgeot_node_tab.cc b/src/bgeot_node_tab.cc
index 6f85a72..1de52a7 100644
--- a/src/bgeot_node_tab.cc
+++ b/src/bgeot_node_tab.cc
@@ -55,7 +55,8 @@ namespace bgeot {
size_type node_tab::search_node(const base_node &pt,
const scalar_type radius) const {
- if (card() == 0) return size_type(-1);
+ if (card() == 0 || radius < 0.)
+ return size_type(-1);
scalar_type eps_radius = std::max(eps, radius);
for (size_type is = 0; is < 5; ++is) {
@@ -93,8 +94,7 @@ namespace bgeot {
}
size_type node_tab::add_node(const base_node &pt,
- const scalar_type radius,
- bool remove_duplicated_nodes) {
+ const scalar_type radius) {
scalar_type npt = gmm::vect_norm2(pt);
max_radius = std::max(max_radius, npt);
eps = max_radius * prec_factor;
@@ -107,7 +107,7 @@ namespace bgeot {
}
else {
GMM_ASSERT1(dim_ == pt.size(), "Nodes should have the same dimension");
- id = remove_duplicated_nodes ? search_node(pt, radius) : size_type(-1);
+ id = search_node(pt, radius);
if (id == size_type(-1)) {
id = dal::dynamic_tas<base_node>::add(pt);
for (size_type i = 0; i < sorters.size(); ++i) {
diff --git a/src/getfem/bgeot_mesh.h b/src/getfem/bgeot_mesh.h
index bdc4720..9d158e5 100644
--- a/src/getfem/bgeot_mesh.h
+++ b/src/getfem/bgeot_mesh.h
@@ -112,9 +112,8 @@ namespace bgeot {
@param pt the point coordinates.
*/
size_type add_point(const base_node &pt,
- const scalar_type tol=scalar_type(0),
- bool remove_duplicated_nodes = true) {
- return pts.add_node(pt, tol, remove_duplicated_nodes);
+ const scalar_type tol=scalar_type(0)) {
+ return pts.add_node(pt, tol);
}
template<class ITER>
diff --git a/src/getfem/bgeot_node_tab.h b/src/getfem/bgeot_node_tab.h
index 66a924c..46a1054 100644
--- a/src/getfem/bgeot_node_tab.h
+++ b/src/getfem/bgeot_node_tab.h
@@ -80,12 +80,12 @@ namespace bgeot {
or size_type(-1) otherwise.
*/
size_type search_node(const base_node &pt, const scalar_type radius=0)
const;
- /** Add a point to the array or identify it with a very close existing
- point. If remove_duplicated_nodes = false, the identification of close
existing points will be
- omitted and the point simply added to the array.
+ /** Add a point to the array or use an existing point, located within
+ a distance smaller than radius. If radius is negative, the detection
+ of proximate existing points will be omitted and the point will simply
+ be added to the array.
*/
- size_type add_node(const base_node &pt, const scalar_type radius=0,
- bool remove_duplicated_nodes = true);
+ size_type add_node(const base_node &pt, const scalar_type radius=0);
size_type add(const base_node &pt) { return add_node(pt); }
void sup_node(size_type i);
void sup(size_type i) { sup_node(i); }
diff --git a/src/getfem/getfem_projected_fem.h
b/src/getfem/getfem_projected_fem.h
index dc06452..fb8b3d6 100644
--- a/src/getfem/getfem_projected_fem.h
+++ b/src/getfem/getfem_projected_fem.h
@@ -95,8 +95,8 @@ namespace getfem {
mutable bgeot::kdtree tree; // Tree containing the nodes of the
// projected mf_source dofs
mutable std::vector<size_type> ind_dof; /* all functions using this work
- array should keep it full of
- size_type(-1) */
+ array should keep it filled
+ with size_type(-1) */
mutable bgeot::geotrans_inv_convex gic;
mutable base_tensor taux;
mutable fem_interpolation_context fictx;
@@ -106,9 +106,9 @@ namespace getfem {
mutable bgeot::multi_index mi2, mi3;
mutable base_node ptref;
- void build_kdtree(void) const;
+ void build_kdtree() const;
- bool find_a_projected_point(base_node pt, base_node &ptr_proj,
+ bool find_a_projected_point(const base_node &pt, base_node &ptr_proj,
size_type &cv_proj, short_type &fc_proj) const;
virtual void update_from_context(void) const;
diff --git a/src/getfem_generic_assembly_semantic.cc
b/src/getfem_generic_assembly_semantic.cc
index 524e05e..4131bef 100644
--- a/src/getfem_generic_assembly_semantic.cc
+++ b/src/getfem_generic_assembly_semantic.cc
@@ -375,13 +375,13 @@ namespace getfem {
}
# define ga_valid_operand(pnode) \
- { \
- if (pnode && (pnode->node_type == GA_NODE_PREDEF_FUNC || \
- pnode->node_type == GA_NODE_SPEC_FUNC || \
- pnode->node_type == GA_NODE_NAME || \
- pnode->node_type == GA_NODE_OPERATOR || \
- pnode->node_type == GA_NODE_ALLINDICES)) \
- ga_throw_error(pnode->expr, pnode->pos, "Invalid term"); \
+ { \
+ if (pnode && (pnode->node_type == GA_NODE_PREDEF_FUNC || \
+ pnode->node_type == GA_NODE_SPEC_FUNC || \
+ pnode->node_type == GA_NODE_NAME || \
+ pnode->node_type == GA_NODE_OPERATOR || \
+ pnode->node_type == GA_NODE_ALLINDICES)) \
+ ga_throw_error(pnode->expr, pnode->pos, "Invalid term"); \
}
static void ga_node_analysis(ga_tree &tree,
diff --git a/src/getfem_import.cc b/src/getfem_import.cc
index 45ae18e..c30b449 100644
--- a/src/getfem_import.cc
+++ b/src/getfem_import.cc
@@ -274,7 +274,8 @@ namespace getfem {
size_type node_id;
base_node n(3); n[0]=n[1]=n[2]=0.0;
f >> node_id >> n[0] >> n[1] >> n[2];
- msh_node_2_getfem_node[node_id] = m.add_point(n, 0.0,
remove_duplicated_nodes);
+ msh_node_2_getfem_node[node_id]
+ = m.add_point(n, remove_duplicated_nodes ? 0. : -1.);
}
if (version == 2)
@@ -849,7 +850,7 @@ namespace getfem {
for (size_type j=0; j < 3; ++j, pos += fieldwidth2)
pt[j] = std::stod(line.substr(pos, fieldwidth2));
- cdb_node_2_getfem_node[nodeid] = m.add_point(pt, 0., false);
+ cdb_node_2_getfem_node[nodeid] = m.add_point(pt, -1.);
}
while (bgeot::casecmp(line.substr(0,6),"EBLOCK") != 0) {
diff --git a/src/getfem_projected_fem.cc b/src/getfem_projected_fem.cc
index 34adf8d..0050b0b 100644
--- a/src/getfem_projected_fem.cc
+++ b/src/getfem_projected_fem.cc
@@ -251,7 +251,7 @@ namespace getfem {
tree.add_point_with_id(mf_source.point_of_basic_dof(dof), dof);
}
- bool projected_fem::find_a_projected_point(base_node pt, base_node &ptr_proj,
+ bool projected_fem::find_a_projected_point(const base_node &pt, base_node
&ptr_proj,
size_type &cv_proj, short_type
&fc_proj) const {
bgeot::index_node_pair ipt;