From: wolf Date: Mon, 16 Sep 2002 20:08:10 +0000 (+0000) Subject: Don't set up component-to-system-tables when they are of no use, X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=afc9df27e5e020591cfd4657a5f77ca9e7ffccc3;p=dealii-svn.git Don't set up component-to-system-tables when they are of no use, i.e. for the non-primitive case. git-svn-id: https://svn.dealii.org/trunk@6435 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/fe/fe_system.cc b/deal.II/deal.II/source/fe/fe_system.cc index 9b8e526df9..67a339c228 100644 --- a/deal.II/deal.II/source/fe/fe_system.cc +++ b/deal.II/deal.II/source/fe/fe_system.cc @@ -943,24 +943,39 @@ FESystem::build_cell_tables() // components to linear // index. Fortunately, this is the // inverse of what we just did. - std::vector dofs_per_component (this->n_components(), 0); - for (unsigned int sys=0; sysdofs_per_cell; ++sys) - ++dofs_per_component[this->system_to_component_index(sys).first]; - for (unsigned int component=0; componentn_components(); ++component) - this->component_to_system_table[component].resize(dofs_per_component[component]); - - // then go the reverse way to fill the array - for (unsigned int sys=0; sysdofs_per_cell; ++sys) + // + // note that we can only do this if + // all sub-elements are primiive, + // otherwise fill the table with + // invalid values + if (this->is_primitive()) { - const unsigned int - comp = this->system_to_component_index(sys).first, - index_in_comp = this->system_to_component_index(sys).second; + std::vector dofs_per_component (this->n_components(), 0); + for (unsigned int sys=0; sysdofs_per_cell; ++sys) + ++dofs_per_component[this->system_to_component_index(sys).first]; + for (unsigned int component=0; componentn_components(); ++component) + this->component_to_system_table[component].resize(dofs_per_component[component]); - Assert (comp < this->component_to_system_table.size(), - ExcInternalError()); - Assert (index_in_comp < this->component_to_system_table[comp].size(), - ExcInternalError()); - this->component_to_system_table[comp][index_in_comp] = sys; + // then go the reverse way to fill the array + for (unsigned int sys=0; sysdofs_per_cell; ++sys) + { + const unsigned int + comp = this->system_to_component_index(sys).first, + index_in_comp = this->system_to_component_index(sys).second; + + Assert (comp < this->component_to_system_table.size(), + ExcInternalError()); + Assert (index_in_comp < this->component_to_system_table[comp].size(), + ExcInternalError()); + this->component_to_system_table[comp][index_in_comp] = sys; + }; + } + else + // element is not primitive, so + // fill elements with nonsense + { + std::vector< std::vector > tmp; + this->component_to_system_table.swap (tmp); }; }; @@ -1145,26 +1160,38 @@ FESystem::build_face_tables() Assert (total_index == this->face_system_to_base_table.size(), ExcInternalError()); - // finally, initialize reverse mapping - std::vector dofs_per_component (this->n_components(), 0); - for (unsigned int sys=0; sysdofs_per_face; ++sys) - ++dofs_per_component[this->face_system_to_component_index(sys).first]; - for (unsigned int component=0; componentn_components(); ++component) - this->face_component_to_system_table[component].resize(dofs_per_component[component]); + // finally, initialize reverse + // mapping. same applies + // w.r.t. primitivity as above: + if (this->is_primitive()) + { + std::vector dofs_per_component (this->n_components(), 0); + for (unsigned int sys=0; sysdofs_per_face; ++sys) + ++dofs_per_component[this->face_system_to_component_index(sys).first]; + for (unsigned int component=0; componentn_components(); ++component) + this->face_component_to_system_table[component].resize(dofs_per_component[component]); // then go the reverse way to fill // the array - for (unsigned int sys=0; sysdofs_per_face; ++sys) + for (unsigned int sys=0; sysdofs_per_face; ++sys) + { + const unsigned int + comp = this->face_system_to_component_index(sys).first, + index_in_comp = this->face_system_to_component_index(sys).second; + + Assert (comp < this->face_component_to_system_table.size(), + ExcInternalError()); + Assert (index_in_comp < this->face_component_to_system_table[comp].size(), + ExcInternalError()); + this->face_component_to_system_table[comp][index_in_comp] = sys; + }; + } + else + // element is not primitive, so + // fill elements with nonsense { - const unsigned int - comp = this->face_system_to_component_index(sys).first, - index_in_comp = this->face_system_to_component_index(sys).second; - - Assert (comp < this->face_component_to_system_table.size(), - ExcInternalError()); - Assert (index_in_comp < this->face_component_to_system_table[comp].size(), - ExcInternalError()); - this->face_component_to_system_table[comp][index_in_comp] = sys; + std::vector< std::vector > tmp; + this->face_component_to_system_table.swap (tmp); }; };