From: Wolfgang Bangerth Date: Sat, 6 Feb 2021 17:30:20 +0000 (-0700) Subject: Move get_default_linear_mapping() to mapping.h/cc. X-Git-Tag: v9.3.0-rc1~493^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf497bba15eb74b79eff25428b9f9b7f56516675;p=dealii.git Move get_default_linear_mapping() to mapping.h/cc. --- diff --git a/include/deal.II/fe/mapping.h b/include/deal.II/fe/mapping.h index f8c4e1de0d..d74b0680a2 100644 --- a/include/deal.II/fe/mapping.h +++ b/include/deal.II/fe/mapping.h @@ -1285,6 +1285,18 @@ public: }; +/** + * Return a default linear mapping that works for the given triangulation. + * Internally, this function calls the function above for the reference + * cell used by the given triangulation, assuming that the triangulation + * uses only a single cell type. If the triangulation uses mixed cell + * types, then this function will trigger an exception. + */ +template +const Mapping & +get_default_linear_mapping(const Triangulation &triangulation); + + DEAL_II_NAMESPACE_CLOSE #endif diff --git a/include/deal.II/grid/reference_cell.h b/include/deal.II/grid/reference_cell.h index 0aeba9a6d0..0287f19505 100644 --- a/include/deal.II/grid/reference_cell.h +++ b/include/deal.II/grid/reference_cell.h @@ -29,9 +29,8 @@ DEAL_II_NAMESPACE_OPEN // Forward declarations #ifndef DOXYGEN template -class Triangulation; -template class Mapping; + template class Quadrature; #endif @@ -750,16 +749,6 @@ ReferenceCell::unit_normal_vectors(const unsigned int face_no) const return {}; } -/** - * Return a default linear mapping that works for the given triangulation. - * Internally, this function calls the function above for the reference - * cell used by the given triangulation, assuming that the triangulation - * uses only a single cell type. If the triangulation uses mixed cell - * types, then this function will trigger an exception. - */ -template -const Mapping & -get_default_linear_mapping(const Triangulation &triangulation); namespace internal { diff --git a/source/fe/mapping.cc b/source/fe/mapping.cc index 6d1235403d..2776bd8112 100644 --- a/source/fe/mapping.cc +++ b/source/fe/mapping.cc @@ -233,7 +233,25 @@ Mapping::InternalDataBase::memory_consumption() const } -/*------------------------------ InternalData ------------------------------*/ +/* ------------------------------ Global functions ------------------------- */ + +template +const Mapping & +get_default_linear_mapping(const Triangulation &triangulation) +{ + const auto &reference_cells = triangulation.get_reference_cells(); + Assert(reference_cells.size() == 1, + ExcMessage( + "This function can only work for triangulations that " + "use only a single cell type -- for example, only triangles " + "or only quadrilaterals. For mixed meshes, there is no " + "single linear mapping object that can be used for all " + "cells of the triangulation. The triangulation you are " + "passing to this function uses multiple cell types.")); + + return reference_cells.front() + .template get_default_linear_mapping(); +} diff --git a/source/fe/mapping.inst.in b/source/fe/mapping.inst.in index 74b10e6a1e..2b6a21b5a3 100644 --- a/source/fe/mapping.inst.in +++ b/source/fe/mapping.inst.in @@ -19,5 +19,10 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) { #if deal_II_dimension <= deal_II_space_dimension template class Mapping; + + template const Mapping + &get_default_linear_mapping( + const Triangulation + &triangulation); #endif } diff --git a/source/grid/reference_cell.cc b/source/grid/reference_cell.cc index c96a8fcb87..cc585cea2d 100644 --- a/source/grid/reference_cell.cc +++ b/source/grid/reference_cell.cc @@ -167,26 +167,6 @@ ReferenceCell::get_default_linear_mapping() const -template -const Mapping & -get_default_linear_mapping(const Triangulation &triangulation) -{ - const auto &reference_cells = triangulation.get_reference_cells(); - Assert(reference_cells.size() == 1, - ExcMessage( - "This function can only work for triangulations that " - "use only a single cell type -- for example, only triangles " - "or only quadrilaterals. For mixed meshes, there is no " - "single linear mapping object that can be used for all " - "cells of the triangulation. The triangulation you are " - "passing to this function uses multiple cell types.")); - - return reference_cells.front() - .template get_default_linear_mapping(); -} - - - template Quadrature ReferenceCell::get_gauss_type_quadrature(const unsigned n_points_1D) const diff --git a/source/grid/reference_cell.inst.in b/source/grid/reference_cell.inst.in index 4c3defee4d..4605e56bf1 100644 --- a/source/grid/reference_cell.inst.in +++ b/source/grid/reference_cell.inst.in @@ -22,11 +22,6 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) template const Mapping &ReferenceCell::get_default_linear_mapping() const; - - template const Mapping - &get_default_linear_mapping( - const Triangulation - &triangulation); #endif }