From: Guido Kanschat Date: Thu, 26 Jan 2006 11:16:29 +0000 (+0000) Subject: add support for nonprimitive elements X-Git-Tag: v8.0.0~12496 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb4049b7b7369aaf7dfc96098c69c2be91da4555;p=dealii.git add support for nonprimitive elements git-svn-id: https://svn.dealii.org/trunk@12179 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/dofs/dof_tools.h b/deal.II/deal.II/include/dofs/dof_tools.h index 1fffaf1d5e..4639fec470 100644 --- a/deal.II/deal.II/include/dofs/dof_tools.h +++ b/deal.II/deal.II/include/dofs/dof_tools.h @@ -1478,6 +1478,45 @@ class DoFTools map_support_points_to_dofs (const Mapping &mapping, const DH &dof_handler, std::map, unsigned int, Comp> &point_to_index_map); + + /** + * Map a coupling table from the + * user friendly organization by + * components to the organization + * by blocks. Specializations of + * this function for DoFHandler + * and hp::DoFHandler are + * required due to the different + * results of their finite + * element access. + * + * The return vector will be + * initialized to the correct + * length inside this function. + */ + template + void convert_couplings_to_blocks (const hp::DoFHandler& dof_handler, + const Table<2, Coupling>& table_by_component, + std::vector >& tables_by_block); + /** + * Map a coupling table from the + * user friendly organization by + * components to the organization + * by blocks. Specializations of + * this function for DoFHandler + * and hp::DoFHandler are + * required due to the different + * results of their finite + * element access. + * + * The return vector will be + * initialized to the correct + * length inside this function. + */ + template + void convert_couplings_to_blocks (const DoFHandler& dof_handler, + const Table<2, Coupling>& table_by_component, + std::vector >& tables_by_block); /** * Exception @@ -1594,6 +1633,36 @@ class DoFTools }; +/** + * Operator computing the maximum coupling out of two. + * + * @relates DoFTools + */ +DoFTools::Coupling operator |= (const DoFTools::Coupling& c1, + const DoFTools::Coupling& c2) +{ + if (c1 == DoFTools::always || c2 == DoFTools::always) + return DoFTools::always; + if (c1 == DoFTools::nonzero || c2 == DoFTools::nonzero) + return DoFTools::nonzero; + return DoFTools::none; +} + + +/** + * Operator computing the maximum coupling out of two. + * + * @relates DoFTools + */ +DoFTools::Coupling operator | (const DoFTools::Coupling& c1, + const DoFTools::Coupling& c2) +{ + if (c1 == DoFTools::always || c2 == DoFTools::always) + return DoFTools::always; + if (c1 == DoFTools::nonzero || c2 == DoFTools::nonzero) + return DoFTools::nonzero; + return DoFTools::none; +} // ---------------------- inline and template functions -------------------- diff --git a/deal.II/deal.II/source/dofs/dof_tools.cc b/deal.II/deal.II/source/dofs/dof_tools.cc index d880f8ee5b..ce2fe38089 100644 --- a/deal.II/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/deal.II/source/dofs/dof_tools.cc @@ -3550,6 +3550,62 @@ DoFTools::compute_dof_couplings( } +template +void +DoFTools::convert_couplings_to_blocks ( + const DoFHandler& dof_handler, + const Table<2, Coupling>& table, + std::vector >& tables_by_block) +{ + const FiniteElement& fe = dof_handler.get_fe(); + const unsigned int nb = fe.n_blocks(); + + tables_by_block.resize(1); + tables_by_block[0].reinit(nb, nb); + tables_by_block[0].fill(none); + + for (unsigned int i=0;i +void +DoFTools::convert_couplings_to_blocks ( + const hp::DoFHandler& dof_handler, + const Table<2, Coupling>& table, + std::vector >& tables_by_block) +{ + const hp::FECollection& coll = dof_handler.get_fe(); + tables_by_block.resize(coll.n_finite_elements()); + + for (unsigned int f=0;f& fe = coll.ge_fe(f); + + const unsigned int nb = fe.n_blocks(); + tables_by_block[f].reinit(nb, nb); + tables_by_block[f].fill(none); + for (unsigned int i=0;i template void DoFTools::map_dofs_to_support_points -(const Mapping &mapping, - const DoFHandler &dof_handler, - std::vector > &support_points); +(const Mapping&, + const DoFHandler&, + std::vector >&); template void DoFTools::compute_dof_couplings( - Table<2,Coupling>& dof_couplings, - const Table<2,Coupling>& component_couplings, - const FiniteElement& fe); + Table<2,Coupling>&, const Table<2,Coupling>&, + const FiniteElement&); + +template +void +DoFTools::convert_couplings_to_blocks ( + const DoFHandler&, const Table<2, Coupling>&, + std::vector >&); + +template +void +DoFTools::convert_couplings_to_blocks ( + const hp::DoFHandler&, const Table<2, Coupling>&, + std::vector >&); +