[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: |
Wed, 13 Mar 2019 17:45:22 -0400 (EDT) |
branch: debug_assembly_breakage
commit be317eb0246fd2682a50c8028e106f809f9b6704
Author: Konstantinos Poulios <address@hidden>
Date: Wed Mar 13 22:28:16 2019 +0100
Revert 2
---
src/getfem/getfem_generic_assembly.h | 14 ++++----
.../getfem_generic_assembly_compile_and_exec.h | 21 ++++++-----
src/getfem_generic_assembly_compile_and_exec.cc | 41 +++++++++++-----------
3 files changed, 40 insertions(+), 36 deletions(-)
diff --git a/src/getfem/getfem_generic_assembly.h
b/src/getfem/getfem_generic_assembly.h
index 4312ec8..32f90f7 100644
--- a/src/getfem/getfem_generic_assembly.h
+++ b/src/getfem/getfem_generic_assembly.h
@@ -270,14 +270,13 @@ namespace getfem {
struct var_description {
- const bool is_variable;
- const bool is_fem_dofs;
+ bool is_variable;
+ bool is_fem_dofs;
const mesh_fem *mf;
- const im_data *imd;
gmm::sub_interval I;
const model_real_plain_vector *V;
- bgeot::multi_index qdims; // For data having a qdim different than
- // the qdim of the fem or im_data
+ const im_data *imd;
+ bgeot::multi_index qdims; // For data having a qdim != of the fem
// (dim per dof for dof data)
// and for constant variables.
@@ -290,9 +289,8 @@ namespace getfem {
var_description(bool is_var, const mesh_fem *mf_, const im_data *imd_,
gmm::sub_interval I_, const model_real_plain_vector *v,
size_type Q)
- : is_variable(is_var), is_fem_dofs(mf_ != 0), mf(mf_), imd(imd_),
- I(I_), V(v), qdims(1)
- {
+ : is_variable(is_var), is_fem_dofs(mf_ != 0), mf(mf_), I(I_), V(v),
+ imd(imd_), qdims(1) {
GMM_ASSERT1(Q > 0, "Bad dimension");
qdims[0] = Q;
}
diff --git a/src/getfem/getfem_generic_assembly_compile_and_exec.h
b/src/getfem/getfem_generic_assembly_compile_and_exec.h
index e2372ec..36588f5 100644
--- a/src/getfem/getfem_generic_assembly_compile_and_exec.h
+++ b/src/getfem/getfem_generic_assembly_compile_and_exec.h
@@ -69,7 +69,9 @@ namespace getfem {
};
typedef std::shared_ptr<ga_instruction> pga_instruction;
+ typedef std::vector<pga_instruction> ga_instruction_list;
+
struct gauss_pt_corresp { // For neighbour interpolation transformation
bgeot::pgeometric_trans pgt1, pgt2;
papprox_integration pai;
@@ -183,22 +185,25 @@ namespace getfem {
std::map<std::string, elementary_trans_info> elementary_trans_infos;
secondary_domain_info secondary_domain_infos;
- std::vector<pga_instruction>
- begin_instructions, // Instructions being executed at the first Gauss
- // point after a change of integration method
only.
- elt_instructions, // Instructions executed once per element
- instructions; // Instructions executed on each
- // integration/interpolation point
+ // Instructions being executed at the first Gauss point after
+ // a change of integration method only.
+ ga_instruction_list begin_instructions;
+ // Instructions executed once per element
+ ga_instruction_list elt_instructions;
+ // Instructions executed on each integration/interpolation point
+ ga_instruction_list instructions;
std::map<scalar_type, std::list<pga_tree_node> > node_list;
- region_mim_instructions(): m(0), im(0) {}
+ region_mim_instructions(): m(0), im(0) {}
};
std::list<ga_tree> trees; // The trees are stored mainly because they
// contain the intermediary tensors.
std::list<ga_tree> interpolation_trees;
- std::map<region_mim, region_mim_instructions> all_instructions;
+ typedef std::map<region_mim, region_mim_instructions> instructions_set;
+
+ instructions_set whole_instructions;
ga_instruction_set() { max_dof = nb_dof = 0; need_elt_size = false; ipt=0;
}
};
diff --git a/src/getfem_generic_assembly_compile_and_exec.cc
b/src/getfem_generic_assembly_compile_and_exec.cc
index eab8a04..e1abc6c 100644
--- a/src/getfem_generic_assembly_compile_and_exec.cc
+++ b/src/getfem_generic_assembly_compile_and_exec.cc
@@ -6592,17 +6592,17 @@ namespace getfem {
GMM_ASSERT1(!scalar || (root->tensor().size() == 1),
"The result of the given expression is not a scalar");
ga_instruction_set::region_mim rm(td.mim, td.rg, 0);
- gis.all_instructions[rm].m = td.m;
+ gis.whole_instructions[rm].m = td.m;
ga_if_hierarchy if_hierarchy;
- ga_compile_node(root, workspace, gis, gis.all_instructions[rm],
- *(td.m), true, if_hierarchy);
+ ga_compile_node(root, workspace, gis,
+ gis.whole_instructions[rm],*(td.m),true,if_hierarchy);
gis.coeff = scalar_type(1);
pga_instruction pgai;
workspace.assembled_tensor() = root->tensor();
pgai = std::make_shared<ga_instruction_add_to_coeff>
(workspace.assembled_tensor(), root->tensor(), gis.coeff);
- gis.all_instructions[rm].instructions.push_back(std::move(pgai));
+ gis.whole_instructions[rm].instructions.push_back(std::move(pgai));
}
}
}
@@ -6696,7 +6696,7 @@ namespace getfem {
void ga_compile_interpolation(ga_workspace &workspace,
ga_instruction_set &gis) {
gis.transformations.clear();
- gis.all_instructions.clear();
+ gis.whole_instructions.clear();
for (size_type i = 0; i < workspace.nb_trees(); ++i) {
const ga_workspace::tree_description &td = workspace.tree_info(i);
if (td.operation != ga_workspace::ASSEMBLY) {
@@ -6711,7 +6711,8 @@ namespace getfem {
if (root) {
// Compile tree
ga_instruction_set::region_mim rm(td.mim, td.rg, 0);
- auto &rmi = gis.all_instructions[rm];
+ ga_instruction_set::region_mim_instructions &rmi
+ = gis.whole_instructions[rm];
rmi.m = td.m;
rmi.im = td.mim;
// rmi.interpolate_infos.clear();
@@ -6732,7 +6733,7 @@ namespace getfem {
void ga_compile(ga_workspace &workspace,
ga_instruction_set &gis, size_type order) {
gis.transformations.clear();
- gis.all_instructions.clear();
+ gis.whole_instructions.clear();
std::array<ga_workspace::operation_type,3>
phases{ga_workspace::PRE_ASSIGNMENT,
ga_workspace::ASSEMBLY,
@@ -6762,7 +6763,7 @@ namespace getfem {
if (trees.back().secondary_domain.size())
psd = workspace.secondary_domain(trees.back().secondary_domain);
ga_instruction_set::region_mim rm(td.mim, td.rg, psd);
- auto &rmi = gis.all_instructions[rm];
+ auto &rmi = gis.whole_instructions[rm];
rmi.m = td.m;
rmi.im = td.mim;
// rmi.interpolate_infos.clear();
@@ -6773,7 +6774,7 @@ namespace getfem {
// cout << endl;
if (phase != ga_workspace::ASSEMBLY) { // Assignment/interpolation
- if (!td.varname_interpolation.empty()) {
+ if (!td.varname_interpolation.empty()) { // assignment
auto *imd
= workspace.associated_im_data(td.varname_interpolation);
auto &V = const_cast<model_real_plain_vector &>
@@ -6959,8 +6960,8 @@ namespace getfem {
void ga_function_exec(ga_instruction_set &gis) {
- for (auto &&instr : gis.all_instructions) {
- const auto &gil = instr.second.instructions;
+ for (auto &&instr : gis.whole_instructions) {
+ ga_instruction_list &gil = instr.second.instructions;
for (size_type j = 0; j < gil.size(); ++j) j += gil[j]->exec();
}
}
@@ -6974,16 +6975,16 @@ namespace getfem {
for (const std::string &t : gis.transformations)
workspace.interpolate_transformation(t)->init(workspace);
- for (auto &&instr : gis.all_instructions) {
+ for (auto &&instr : gis.whole_instructions) {
const getfem::mesh_im &mim = *(instr.first.mim());
const mesh_region ®ion = *(instr.first.region());
const getfem::mesh &m = *(instr.second.m);
GMM_ASSERT1(&m == &(gic.linked_mesh()),
"Incompatibility of meshes in interpolation");
- const auto &gilb = instr.second.begin_instructions;
- const auto &gile = instr.second.elt_instructions;
- const auto &gil = instr.second.instructions;
+ ga_instruction_list &gilb = instr.second.begin_instructions;
+ ga_instruction_list &gile = instr.second.elt_instructions;
+ ga_instruction_list &gil = instr.second.instructions;
// iteration on elements (or faces of elements)
std::vector<size_type> ind;
@@ -7066,15 +7067,15 @@ namespace getfem {
gis.ipt = 0;
gis.pai = 0;
- for (auto &&instr : gis.all_instructions) {
+ for (auto &&instr : gis.whole_instructions) {
const getfem::mesh &m = *(instr.second.m);
GMM_ASSERT1(&m == &interp_mesh,
"Incompatibility of meshes in interpolation");
- auto &gilb = instr.second.begin_instructions;
+ ga_instruction_list &gilb = instr.second.begin_instructions;
for (size_type j = 0; j < gilb.size(); ++j) j += gilb[j]->exec();
- auto &gile = instr.second.elt_instructions;
+ ga_instruction_list &gile = instr.second.elt_instructions;
for (size_type j = 0; j < gile.size(); ++j) j+=gile[j]->exec();
- auto &gil = instr.second.instructions;
+ ga_instruction_list &gil = instr.second.instructions;
for (size_type j = 0; j < gil.size(); ++j) j += gil[j]->exec();
}
}
@@ -7087,7 +7088,7 @@ namespace getfem {
for (const std::string &t : gis.transformations)
workspace.interpolate_transformation(t)->init(workspace);
- for (auto &instr : gis.all_instructions) {
+ for (auto &instr : gis.whole_instructions) {
const getfem::mesh_im &mim = *(instr.first.mim());
psecondary_domain psd = instr.first.psd();
const getfem::mesh &m = *(instr.second.m);