From: Guido Kanschat Date: Tue, 2 May 2006 06:18:17 +0000 (+0000) Subject: new template structure for DataOut... X-Git-Tag: v8.0.0~11818 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4fae6f240ecf89ce626fbc5a73b2093df9bc4de7;p=dealii.git new template structure for DataOut... git-svn-id: https://svn.dealii.org/trunk@12960 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/numerics/data_out.h b/deal.II/deal.II/include/numerics/data_out.h index 21bed58878..6daea8bc2c 100644 --- a/deal.II/deal.II/include/numerics/data_out.h +++ b/deal.II/deal.II/include/numerics/data_out.h @@ -25,7 +25,7 @@ #include -template class FEValuesBase; +template class FEValuesBase; //TODO: Most of the documentation of DataOut_DoFData applies to DataOut. @@ -162,13 +162,13 @@ template class FEValuesBase; * @ingroup output * @author Wolfgang Bangerth, 1999 */ -template class DH, - int patch_dim, int patch_space_dim=patch_dim> +template class DataOut_DoFData : public DataOutInterface { +//TODO: Do we still need this after changing the template argument? #ifdef DEAL_II_TEMPLATE_TEMPLATE_TYPEDEF_BUG // helper class - struct DH_dim : public DH + struct DH_dim : public DH { // constructor. will // not be implemented, @@ -181,8 +181,8 @@ class DataOut_DoFData : public DataOutInterface * Declare iterator type, for * access from outside. */ - typedef typename DH::cell_iterator cell_iterator; - typedef typename DH::active_cell_iterator active_cell_iterator; + typedef typename DH::cell_iterator cell_iterator; + typedef typename DH::active_cell_iterator active_cell_iterator; }; public: @@ -202,8 +202,8 @@ class DataOut_DoFData : public DataOutInterface * of the dof handler class under * consideration. */ - typedef typename DH::cell_iterator cell_iterator; - typedef typename DH::active_cell_iterator active_cell_iterator; + typedef typename DH::cell_iterator cell_iterator; + typedef typename DH::active_cell_iterator active_cell_iterator; #endif public: @@ -251,7 +251,7 @@ class DataOut_DoFData : public DataOutInterface * and the mapping between nodes * and node values. */ - void attach_dof_handler (const DH &); + void attach_dof_handler (const DH &); /** * Add a data vector together @@ -456,8 +456,8 @@ class DataOut_DoFData : public DataOutInterface * object did not yet set up any * patches. */ - template - void merge_patches (const DataOut_DoFData &source, + template + void merge_patches (const DataOut_DoFData &source, const Point &shift = Point()); /** @@ -586,7 +586,7 @@ class DataOut_DoFData : public DataOutInterface */ virtual void - get_function_values (const FEValuesBase &fe_patch_values, + get_function_values (const FEValuesBase &fe_patch_values, std::vector &patch_values) const = 0; /** @@ -599,7 +599,7 @@ class DataOut_DoFData : public DataOutInterface */ virtual void - get_function_values (const FEValuesBase &fe_patch_values, + get_function_values (const FEValuesBase &fe_patch_values, std::vector > &patch_values_system) const = 0; /** @@ -660,7 +660,7 @@ class DataOut_DoFData : public DataOutInterface */ virtual void - get_function_values (const FEValuesBase &fe_patch_values, + get_function_values (const FEValuesBase &fe_patch_values, std::vector &patch_values) const; /** @@ -673,7 +673,7 @@ class DataOut_DoFData : public DataOutInterface */ virtual void - get_function_values (const FEValuesBase &fe_patch_values, + get_function_values (const FEValuesBase &fe_patch_values, std::vector > &patch_values_system) const; /** @@ -710,7 +710,7 @@ class DataOut_DoFData : public DataOutInterface /** * Pointer to the dof handler object. */ - SmartPointer > dofs; + SmartPointer dofs; /** * List of data elements with vectors of @@ -755,7 +755,7 @@ class DataOut_DoFData : public DataOutInterface * friends. Needed for the * merge_patches() function. */ - template class, int,int> + template friend class DataOut_DoFData; #ifdef DEAL_II_NESTED_CLASS_FRIEND_BUG @@ -780,7 +780,7 @@ class DataOut_DoFData : public DataOutInterface # else template class DH1, int N2, int N3> template - friend class DataOut_DoFData::DataEntry; + friend class DataOut_DoFData::DataEntry; # endif #endif }; @@ -861,8 +861,8 @@ class DataOut_DoFData : public DataOutInterface * @ingroup output * @author Wolfgang Bangerth, 1999 */ -template class DH = DoFHandler> -class DataOut : public DataOut_DoFData +template > +class DataOut : public DataOut_DoFData { public: /** @@ -870,8 +870,8 @@ class DataOut : public DataOut_DoFData * of the dof handler class under * consideration. */ - typedef typename DataOut_DoFData::cell_iterator cell_iterator; - typedef typename DataOut_DoFData::active_cell_iterator active_cell_iterator; + typedef typename DataOut_DoFData::cell_iterator cell_iterator; + typedef typename DataOut_DoFData::active_cell_iterator active_cell_iterator; /** * This is the central function @@ -929,7 +929,7 @@ class DataOut : public DataOut_DoFData * vector that holds the * deformation of each vertex. */ - virtual void build_patches (const Mapping &mapping, + virtual void build_patches (const Mapping &mapping, const unsigned int n_subdivisions = 1, const unsigned int n_threads = multithread_info.n_default_threads); @@ -1000,7 +1000,7 @@ class DataOut : public DataOut_DoFData unsigned int n_components; unsigned int n_datasets; unsigned int n_subdivisions; - SmartPointer > mapping; + SmartPointer > mapping; std::vector patch_values; std::vector > patch_values_system; @@ -1021,12 +1021,11 @@ class DataOut : public DataOut_DoFData // -------------------- template and inline functions ------------------------ -template class DH, - int patch_dim, int patch_space_dim> -template +template +template void -DataOut_DoFData:: -merge_patches (const DataOut_DoFData &source, +DataOut_DoFData:: +merge_patches (const DataOut_DoFData &source, const Point &shift) { const std::vector source_patches = source.get_patches (); diff --git a/deal.II/deal.II/include/numerics/data_out_faces.h b/deal.II/deal.II/include/numerics/data_out_faces.h index 42689e6386..bf7b8fb150 100644 --- a/deal.II/deal.II/include/numerics/data_out_faces.h +++ b/deal.II/deal.II/include/numerics/data_out_faces.h @@ -20,7 +20,6 @@ #include #include -template class DoFHandler; /** @@ -78,8 +77,9 @@ template class DoFHandler; * @ingroup output * @author Wolfgang Bangerth, 2000 */ -template class DH = DoFHandler> -class DataOutFaces : public DataOut_DoFData +template > +class DataOutFaces : public DataOut_DoFData { public: /** @@ -87,7 +87,8 @@ class DataOutFaces : public DataOut_DoFData * of the dof handler class under * consideration. */ - typedef typename DataOut_DoFData::cell_iterator cell_iterator; + typedef typename DataOut_DoFData::cell_iterator cell_iterator; /** * This is the central function diff --git a/deal.II/deal.II/include/numerics/data_out_rotation.h b/deal.II/deal.II/include/numerics/data_out_rotation.h index f419c548d1..ba036f17c5 100644 --- a/deal.II/deal.II/include/numerics/data_out_rotation.h +++ b/deal.II/deal.II/include/numerics/data_out_rotation.h @@ -20,7 +20,6 @@ #include #include -template class DoFHandler; /** @@ -80,8 +79,8 @@ template class DoFHandler; * @ingroup output * @author Wolfgang Bangerth, 2000 */ -template class DH = DoFHandler> -class DataOutRotation : public DataOut_DoFData +template > +class DataOutRotation : public DataOut_DoFData { public: /** @@ -89,7 +88,7 @@ class DataOutRotation : public DataOut_DoFData * of the dof handler class under * consideration. */ - typedef typename DataOut_DoFData::cell_iterator cell_iterator; + typedef typename DataOut_DoFData::cell_iterator cell_iterator; /** * This is the central function @@ -202,9 +201,4 @@ class DataOutRotation : public DataOut_DoFData }; -/* -------------- declaration of explicit specializations ------------- */ - -template <> void DataOutRotation<3,DoFHandler>::build_some_patches (Data &); - - #endif diff --git a/deal.II/deal.II/include/numerics/data_out_stack.h b/deal.II/deal.II/include/numerics/data_out_stack.h index 34d9607551..9250f6e31b 100644 --- a/deal.II/deal.II/include/numerics/data_out_stack.h +++ b/deal.II/deal.II/include/numerics/data_out_stack.h @@ -101,7 +101,7 @@ template class DoFHandler; * @ingroup output * @author Wolfgang Bangerth, 1999 */ -template class DH = DoFHandler> +template > class DataOutStack : public DataOutInterface { public: @@ -141,7 +141,7 @@ class DataOutStack : public DataOutInterface * data vectors for the present * parameter value. */ - void attach_dof_handler (const DH &dof_handler); + void attach_dof_handler (const DH& dof_handler); /** * Declare a data vector. The @p vector_type @@ -370,7 +370,7 @@ class DataOutStack : public DataOutInterface * corresponding to the present parameter * value. */ - SmartPointer > dof_handler; + SmartPointer dof_handler; /** * List of patches of all past and diff --git a/deal.II/deal.II/source/numerics/data_out.cc b/deal.II/deal.II/source/numerics/data_out.cc index 40b1ff5033..28344091d1 100644 --- a/deal.II/deal.II/source/numerics/data_out.cc +++ b/deal.II/deal.II/source/numerics/data_out.cc @@ -34,9 +34,8 @@ -template class DH, - int patch_dim, int patch_space_dim> -DataOut_DoFData:: +template +DataOut_DoFData:: DataEntryBase::DataEntryBase (const std::vector &names) : names(names) @@ -44,18 +43,16 @@ DataEntryBase::DataEntryBase (const std::vector &names) -template class DH, - int patch_dim, int patch_space_dim> -DataOut_DoFData:: +template +DataOut_DoFData:: DataEntryBase::~DataEntryBase () {} -template class DH, - int patch_dim, int patch_space_dim> +template template -DataOut_DoFData:: +DataOut_DoFData:: DataEntry:: DataEntry (const VectorType *data, const std::vector &names) @@ -65,11 +62,10 @@ DataEntry (const VectorType *data, {} -template class DH, - int patch_dim, int patch_space_dim> +template template double -DataOut_DoFData:: +DataOut_DoFData:: DataEntry:: get_cell_data_value (const unsigned int cell_number) const { @@ -78,13 +74,12 @@ get_cell_data_value (const unsigned int cell_number) const -template class DH, - int patch_dim, int patch_space_dim> +template template void -DataOut_DoFData:: +DataOut_DoFData:: DataEntry:: -get_function_values (const FEValuesBase &fe_patch_values, +get_function_values (const FEValuesBase &fe_patch_values, std::vector > &patch_values_system) const { fe_patch_values.get_function_values (*vector, patch_values_system); @@ -92,13 +87,13 @@ get_function_values (const FEValuesBase &fe_patch_values, -template class DH, +template template void -DataOut_DoFData:: +DataOut_DoFData:: DataEntry:: -get_function_values (const FEValuesBase &fe_patch_values, +get_function_values (const FEValuesBase &fe_patch_values, std::vector &patch_values) const { fe_patch_values.get_function_values (*vector, patch_values); @@ -106,11 +101,11 @@ get_function_values (const FEValuesBase &fe_patch_values, -template class DH, +template template unsigned int -DataOut_DoFData:: +DataOut_DoFData:: DataEntry::memory_consumption () const { return (sizeof (vector) + @@ -119,11 +114,10 @@ DataEntry::memory_consumption () const -template class DH, - int patch_dim, int patch_space_dim> +template template void -DataOut_DoFData:: +DataOut_DoFData:: DataEntry::clear () { vector = 0; @@ -132,29 +126,27 @@ DataEntry::clear () -template class DH, +template -DataOut_DoFData::DataOut_DoFData () +DataOut_DoFData::DataOut_DoFData () : dofs(0,typeid(*this).name()) {} -template class DH, - int patch_dim, int patch_space_dim> -DataOut_DoFData::~DataOut_DoFData () +template +DataOut_DoFData::~DataOut_DoFData () { clear (); } -template class DH, - int patch_dim, int patch_space_dim> +template void -DataOut_DoFData:: -attach_dof_handler (const DH &d) +DataOut_DoFData:: +attach_dof_handler (const DH &d) { Assert (dof_data.size() == 0, ExcOldDataStillPresent()); Assert (cell_data.size() == 0, ExcOldDataStillPresent()); @@ -164,11 +156,11 @@ attach_dof_handler (const DH &d) -template class DH, +template template void -DataOut_DoFData:: +DataOut_DoFData:: add_data_vector (const VECTOR &vec, const std::vector &names, const DataVectorType type) @@ -238,11 +230,11 @@ add_data_vector (const VECTOR &vec, -template class DH, +template template void -DataOut_DoFData:: +DataOut_DoFData:: add_data_vector (const VECTOR &vec, const std::string &name, const DataVectorType type) @@ -277,9 +269,9 @@ add_data_vector (const VECTOR &vec, -template class DH, +template -void DataOut_DoFData::clear_data_vectors () +void DataOut_DoFData::clear_data_vectors () { dof_data.erase (dof_data.begin(), dof_data.end()); cell_data.erase (cell_data.begin(), cell_data.end()); @@ -291,10 +283,10 @@ void DataOut_DoFData::clear_data_v -template class DH, +template void -DataOut_DoFData:: +DataOut_DoFData:: clear_input_data_references () { for (unsigned int i=0; i class DH, +template void -DataOut_DoFData::clear () +DataOut_DoFData::clear () { dof_data.erase (dof_data.begin(), dof_data.end()); cell_data.erase (cell_data.begin(), cell_data.end()); @@ -327,10 +319,10 @@ DataOut_DoFData::clear () -template class DH, +template std::vector -DataOut_DoFData:: +DataOut_DoFData:: get_dataset_names () const { std::vector names; @@ -355,20 +347,20 @@ get_dataset_names () const -template class DH, +template const std::vector< ::DataOutBase::Patch > & -DataOut_DoFData::get_patches () const +DataOut_DoFData::get_patches () const { return patches; } -template class DH, +template unsigned int -DataOut_DoFData::memory_consumption () const +DataOut_DoFData::memory_consumption () const { return (DataOutInterface::memory_consumption () + MemoryConsumption::memory_consumption (dofs) + @@ -381,11 +373,15 @@ DataOut_DoFData::memory_consumptio -template class DH> +template void DataOut::build_some_patches (Data &data) { + // Check consistency of redundant + // template parameter + Assert (dim==DH::dimension, ExcDimensionMismatch(dim, DH::dimension)); + QTrapez<1> q_trapez; - QIterated patch_points (q_trapez, data.n_subdivisions); + QIterated patch_points (q_trapez, data.n_subdivisions); //TODO[?]: This is strange -- Data has a member 'mapping' that should //be used here, but it isn't. Rather, up until version 1.94, we were @@ -402,15 +398,15 @@ void DataOut::build_some_patches (Data &data) // dof_handler.get_fe() returns a // collection of which we do a // shallow copy instead - const hp::QCollection q_collection (patch_points); - const hp::FECollection fe_collection(this->dofs->get_fe()); + const hp::QCollection q_collection (patch_points); + const hp::FECollection fe_collection(this->dofs->get_fe()); - hp::FEValues x_fe_patch_values (fe_collection, q_collection, + hp::FEValues x_fe_patch_values (fe_collection, q_collection, update_values); const unsigned int n_q_points = patch_points.n_quadrature_points; - typename std::vector< ::DataOutBase::Patch >::iterator patch = this->patches.begin(); + typename std::vector< ::DataOutBase::Patch >::iterator patch = this->patches.begin(); cell_iterator cell=first_cell(); // get first cell in this thread @@ -429,14 +425,14 @@ void DataOut::build_some_patches (Data &data) // use ucd_to_deal map as patch // vertices are in the old, // unnatural ordering - for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) + for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) patch->vertices[vertex] = data.mapping->transform_unit_to_real_cell - (cell, GeometryInfo::unit_cell_vertex (vertex)); + (cell, GeometryInfo::unit_cell_vertex (vertex)); if (data.n_datasets > 0) { x_fe_patch_values.reinit (cell); - const FEValues &fe_patch_values + const FEValues &fe_patch_values = x_fe_patch_values.get_present_fe_values (); // first fill dof_data @@ -490,7 +486,7 @@ void DataOut::build_some_patches (Data &data) } - for (unsigned int f=0; f::faces_per_cell; ++f) + for (unsigned int f=0; f::faces_per_cell; ++f) { // let's look up whether // the neighbor behind that @@ -533,7 +529,7 @@ void DataOut::build_some_patches (Data &data) || ((*data.cell_to_patch_index_map)[neighbor->level()][neighbor->index()] == - ::DataOutBase::Patch::no_neighbor)) + ::DataOutBase::Patch::no_neighbor)) continue; // now, there is a @@ -557,23 +553,23 @@ void DataOut::build_some_patches (Data &data) -template class DH> +template void DataOut::build_patches (const unsigned int n_subdivisions, const unsigned int n_threads_) { - build_patches (StaticMappingQ1::mapping, n_subdivisions, n_threads_); + build_patches (StaticMappingQ1::mapping, n_subdivisions, n_threads_); } -template class DH> -void DataOut::build_patches (const Mapping &mapping, +template +void DataOut::build_patches (const Mapping &mapping, const unsigned int n_subdivisions, const unsigned int n_threads_) { Assert (n_subdivisions >= 1, ExcInvalidNumberOfSubdivisions(n_subdivisions)); - typedef DataOut_DoFData BaseClass; + typedef DataOut_DoFData BaseClass; Assert (this->dofs != 0, typename BaseClass::ExcNoDoFHandlerSelected()); const unsigned int n_threads = (DEAL_II_USE_MT ? n_threads_ : 1); @@ -583,7 +579,7 @@ void DataOut::build_patches (const Mapping &mapping, // actually has the points on this // patch QTrapez<1> q_trapez; - QIterated patch_points (q_trapez, n_subdivisions); + QIterated patch_points (q_trapez, n_subdivisions); const unsigned int n_q_points = patch_points.n_quadrature_points; const unsigned int n_components = this->dofs->get_fe().n_components(); @@ -593,7 +589,7 @@ void DataOut::build_patches (const Mapping &mapping, // clear the patches array if (true) { - std::vector< ::DataOutBase::Patch > dummy; + std::vector< ::DataOutBase::Patch > dummy; this->patches.swap (dummy); }; @@ -616,7 +612,7 @@ void DataOut::build_patches (const Mapping &mapping, static_cast(cell->index())); cell_to_patch_index_map[l].resize (max_index+1, - ::DataOutBase::Patch::no_neighbor); + ::DataOutBase::Patch::no_neighbor); }; unsigned int n_patches = 0; @@ -644,7 +640,7 @@ void DataOut::build_patches (const Mapping &mapping, // // then number the patches // consecutively - ::DataOutBase::Patch default_patch; + ::DataOutBase::Patch default_patch; default_patch.n_subdivisions = n_subdivisions; default_patch.data.reinit (n_datasets, n_q_points); this->patches.insert (this->patches.end(), n_patches, default_patch); @@ -680,7 +676,7 @@ void DataOut::build_patches (const Mapping &mapping, -template class DH> +template typename DataOut::cell_iterator DataOut::first_cell () { @@ -689,14 +685,14 @@ DataOut::first_cell () -template class DH> +template typename DataOut::cell_iterator DataOut::next_cell (const typename DataOut::cell_iterator &cell) { // convert the iterator to an // active_iterator and advance // this to the next active cell - typename DH::active_cell_iterator active_cell = cell; + typename DH::active_cell_iterator active_cell = cell; ++active_cell; return active_cell; } @@ -704,61 +700,59 @@ DataOut::next_cell (const typename DataOut::cell_iterator &cell) // explicit instantiations -#define INSTANTIATE(D1,DH,D2,D3,V) \ +#define INSTANTIATE(DH,D2,D3,V) \ template void \ -DataOut_DoFData:: \ +DataOut_DoFData:: \ add_data_vector (const V &, \ const std::string &, \ const DataVectorType); \ \ template void \ -DataOut_DoFData:: \ +DataOut_DoFData:: \ add_data_vector (const V &, \ const std::vector &, \ const DataVectorType) #ifndef DEAL_II_USE_PETSC -# define INSTANTIATE_VECTORS(D1,DH,D2,D3) \ - INSTANTIATE(D1,DH,D2,D3,Vector); \ - INSTANTIATE(D1,DH,D2,D3,Vector); \ - INSTANTIATE(D1,DH,D2,D3,BlockVector) ; \ - INSTANTIATE(D1,DH,D2,D3,BlockVector) +# define INSTANTIATE_VECTORS(DH,D2,D3) \ + INSTANTIATE(DH,D2,D3,Vector); \ + INSTANTIATE(DH,D2,D3,Vector); \ + INSTANTIATE(DH,D2,D3,BlockVector) ; \ + INSTANTIATE(DH,D2,D3,BlockVector) #else -# define INSTANTIATE_VECTORS(D1,DH,D2,D3) \ - INSTANTIATE(D1,DH,D2,D3,Vector); \ - INSTANTIATE(D1,DH,D2,D3,Vector); \ - INSTANTIATE(D1,DH,D2,D3,BlockVector) ; \ - INSTANTIATE(D1,DH,D2,D3,BlockVector); \ - INSTANTIATE(D1,DH,D2,D3,PETScWrappers::Vector); \ - INSTANTIATE(D1,DH,D2,D3,PETScWrappers::BlockVector) +# define INSTANTIATE_VECTORS(DH,D2,D3) \ + INSTANTIATE(DH,D2,D3,Vector); \ + INSTANTIATE(DH,D2,D3,Vector); \ + INSTANTIATE(DH,D2,D3,BlockVector) ; \ + INSTANTIATE(DH,D2,D3,BlockVector); \ + INSTANTIATE(DH,D2,D3,PETScWrappers::Vector); \ + INSTANTIATE(DH,D2,D3,PETScWrappers::BlockVector) #endif // now do actual instantiations, first for DoFHandler... -template class DataOut_DoFData; -template class DataOut_DoFData; -INSTANTIATE_VECTORS(deal_II_dimension,DoFHandler,deal_II_dimension,deal_II_dimension); -INSTANTIATE_VECTORS(deal_II_dimension,DoFHandler,deal_II_dimension+1,deal_II_dimension+1); +template class DataOut_DoFData,deal_II_dimension>; +template class DataOut_DoFData,deal_II_dimension+1>; +INSTANTIATE_VECTORS(DoFHandler,deal_II_dimension,deal_II_dimension); +INSTANTIATE_VECTORS(DoFHandler,deal_II_dimension+1,deal_II_dimension+1); // for 3d, also generate an extra class #if deal_II_dimension >= 2 -template class DataOut_DoFData; -INSTANTIATE_VECTORS(deal_II_dimension,DoFHandler,deal_II_dimension-1,deal_II_dimension); +template class DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>; +INSTANTIATE_VECTORS(DoFHandler,deal_II_dimension-1,deal_II_dimension); #endif -template class DataOut; +template class DataOut >; // ...and now for hp::DoFHandler -template class DataOut_DoFData; -template class DataOut_DoFData; -INSTANTIATE_VECTORS(deal_II_dimension,hp::DoFHandler,deal_II_dimension,deal_II_dimension); -INSTANTIATE_VECTORS(deal_II_dimension,hp::DoFHandler,deal_II_dimension+1,deal_II_dimension+1); +template class DataOut_DoFData,deal_II_dimension>; +template class DataOut_DoFData,deal_II_dimension+1>; +INSTANTIATE_VECTORS(hp::DoFHandler,deal_II_dimension,deal_II_dimension); +INSTANTIATE_VECTORS(hp::DoFHandler,deal_II_dimension+1,deal_II_dimension+1); #if deal_II_dimension >= 2 -template class DataOut_DoFData; -INSTANTIATE_VECTORS(deal_II_dimension,hp::DoFHandler,deal_II_dimension-1,deal_II_dimension); +template class DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>; +INSTANTIATE_VECTORS(hp::DoFHandler,deal_II_dimension-1,deal_II_dimension); #endif -template class DataOut; +template class DataOut >; diff --git a/deal.II/deal.II/source/numerics/data_out_faces.cc b/deal.II/deal.II/source/numerics/data_out_faces.cc index 31b2424b95..5e2903ffb9 100644 --- a/deal.II/deal.II/source/numerics/data_out_faces.cc +++ b/deal.II/deal.II/source/numerics/data_out_faces.cc @@ -28,11 +28,15 @@ -template class DH> +template void DataOutFaces::build_some_patches (Data &data) { + // Check consistency of redundant + // template parameter + Assert (dim==DH::dimension, ExcDimensionMismatch(dim, DH::dimension)); + QTrapez<1> q_trapez; - QIterated patch_points (q_trapez, data.n_subdivisions); + QIterated patch_points (q_trapez, data.n_subdivisions); //TODO[?]: This is strange -- Data has a member 'mapping' that should //be used here, but it isn't. Rather, up until version 1.94, we were @@ -49,15 +53,15 @@ void DataOutFaces::build_some_patches (Data &data) // dof_handler.get_fe() returns a // collection of which we do a // shallow copy instead - const hp::QCollection q_collection (patch_points); - const hp::FECollection fe_collection(this->dofs->get_fe()); + const hp::QCollection q_collection (patch_points); + const hp::FECollection fe_collection(this->dofs->get_fe()); - hp::FEFaceValues x_fe_patch_values (fe_collection, q_collection, + hp::FEFaceValues x_fe_patch_values (fe_collection, q_collection, update_values); const unsigned int n_q_points = patch_points.n_quadrature_points; - typename std::vector< ::DataOutBase::Patch >::iterator patch = this->patches.begin(); + typename std::vector< ::DataOutBase::Patch >::iterator patch = this->patches.begin(); FaceDescriptor face=first_face(); // get first face in this thread @@ -73,13 +77,13 @@ void DataOutFaces::build_some_patches (Data &data) { Assert (patch != this->patches.end(), ExcInternalError()); - for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) + for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) patch->vertices[vertex] = face.first->face(face.second)->vertex(vertex); if (data.n_datasets > 0) { x_fe_patch_values.reinit (face.first, face.second); - const FEFaceValues &fe_patch_values + const FEFaceValues &fe_patch_values = x_fe_patch_values.get_present_fe_values (); // first fill dof_data @@ -123,7 +127,7 @@ void DataOutFaces::build_some_patches (Data &data) Assert (face.first->active(), ExcCellNotActiveForCellData()); const unsigned int cell_number = std::distance (this->dofs->begin_active(), - typename DH::active_cell_iterator(face.first)); + typename DH::active_cell_iterator(face.first)); const double value = this->cell_data[dataset]->get_cell_data_value (cell_number); @@ -145,14 +149,14 @@ void DataOutFaces::build_some_patches (Data &data) -template class DH> +template void DataOutFaces::build_patches (const unsigned int n_subdivisions, const unsigned int n_threads_) { Assert (n_subdivisions >= 1, ExcInvalidNumberOfSubdivisions(n_subdivisions)); - typedef DataOut_DoFData BaseClass; + typedef DataOut_DoFData BaseClass; Assert (this->dofs != 0, typename BaseClass::ExcNoDoFHandlerSelected()); const unsigned int n_threads = (DEAL_II_USE_MT ? n_threads_ : 1); @@ -162,7 +166,7 @@ void DataOutFaces::build_patches (const unsigned int n_subdivisions, // actually has the points on this // patch QTrapez<1> q_trapez; - QIterated patch_points (q_trapez, n_subdivisions); + QIterated patch_points (q_trapez, n_subdivisions); const unsigned int n_q_points = patch_points.n_quadrature_points; const unsigned int n_components = this->dofs->get_fe().n_components(); @@ -172,7 +176,7 @@ void DataOutFaces::build_patches (const unsigned int n_subdivisions, // clear the patches array if (true) { - std::vector< ::DataOutBase::Patch > dummy; + std::vector< ::DataOutBase::Patch > dummy; this->patches.swap (dummy); }; @@ -206,7 +210,7 @@ void DataOutFaces::build_patches (const unsigned int n_subdivisions, // values. note that the evaluation // points on the face have to be // repeated in angular direction - ::DataOutBase::Patch default_patch; + ::DataOutBase::Patch default_patch; default_patch.n_subdivisions = n_subdivisions; default_patch.data.reinit (n_datasets, n_q_points); this->patches.insert (this->patches.end(), n_patches, default_patch); @@ -225,15 +229,15 @@ void DataOutFaces::build_patches (const unsigned int n_subdivisions, -template class DH> +template typename DataOutFaces::FaceDescriptor DataOutFaces::first_face () { // simply find first active cell // with a face on the boundary - typename DH::active_cell_iterator cell = this->dofs->begin_active(); + typename DH::active_cell_iterator cell = this->dofs->begin_active(); for (; cell != this->dofs->end(); ++cell) - for (unsigned int f=0; f::faces_per_cell; ++f) + for (unsigned int f=0; f::faces_per_cell; ++f) if (cell->face(f)->at_boundary()) return FaceDescriptor(cell, f); @@ -246,7 +250,7 @@ DataOutFaces::first_face () -template class DH> +template typename DataOutFaces::FaceDescriptor DataOutFaces::next_face (const FaceDescriptor &old_face) { @@ -255,7 +259,7 @@ DataOutFaces::next_face (const FaceDescriptor &old_face) // first check whether the present // cell has more faces on the // boundary - for (unsigned int f=face.second+1; f::faces_per_cell; ++f) + for (unsigned int f=face.second+1; f::faces_per_cell; ++f) if (face.first->face(f)->at_boundary()) // yup, that is so, so return it { @@ -270,7 +274,7 @@ DataOutFaces::next_face (const FaceDescriptor &old_face) // convert the iterator to an // active_iterator and advance // this to the next active cell - typename DH::active_cell_iterator active_cell = face.first; + typename DH::active_cell_iterator active_cell = face.first; // increase face pointer by one ++active_cell; @@ -280,7 +284,7 @@ DataOutFaces::next_face (const FaceDescriptor &old_face) { // check all the faces of this // active cell - for (unsigned int f=0; f::faces_per_cell; ++f) + for (unsigned int f=0; f::faces_per_cell; ++f) if (active_cell->face(f)->at_boundary()) { face.first = active_cell; @@ -304,6 +308,6 @@ DataOutFaces::next_face (const FaceDescriptor &old_face) // explicit instantiations // don't instantiate anything for the 1d and 2d cases #if deal_II_dimension >=2 -template class DataOutFaces; -template class DataOutFaces; +template class DataOutFaces >; +template class DataOutFaces >; #endif diff --git a/deal.II/deal.II/source/numerics/data_out_rotation.cc b/deal.II/deal.II/source/numerics/data_out_rotation.cc index 679f237a45..b1c602e120 100644 --- a/deal.II/deal.II/source/numerics/data_out_rotation.cc +++ b/deal.II/deal.II/source/numerics/data_out_rotation.cc @@ -31,11 +31,14 @@ //TODO: Update documentation //TODO: Unify code for dimensions -template class DH> +// Not implemented for 3D + +#if deal_II_dimension < 3 +template void DataOutRotation::build_some_patches (Data &data) { QTrapez<1> q_trapez; - QIterated patch_points (q_trapez, data.n_subdivisions); + QIterated patch_points (q_trapez, data.n_subdivisions); // create collection objects from // single quadratures, @@ -50,10 +53,10 @@ void DataOutRotation::build_some_patches (Data &data) // transformed using a Q1 mapping, // we don't support anything else // as well - const hp::QCollection q_collection (patch_points); - const hp::FECollection fe_collection(this->dofs->get_fe()); + const hp::QCollection q_collection (patch_points); + const hp::FECollection fe_collection(this->dofs->get_fe()); - hp::FEValues x_fe_patch_values (fe_collection, q_collection, + hp::FEValues x_fe_patch_values (fe_collection, q_collection, update_values); const unsigned int n_patches_per_circle = data.n_patches_per_circle; @@ -72,18 +75,18 @@ void DataOutRotation::build_some_patches (Data &data) // place. for simplicity add the // initial direction at the end // again - std::vector > angle_directions (n_patches_per_circle+1); + std::vector > angle_directions (n_patches_per_circle+1); for (unsigned int i=0; i<=n_patches_per_circle; ++i) { - angle_directions[i][dim-1] = std::cos(2*deal_II_numbers::PI * + angle_directions[i][DH::dimension-1] = std::cos(2*deal_II_numbers::PI * i/n_patches_per_circle); - angle_directions[i][dim] = std::sin(2*deal_II_numbers::PI * + angle_directions[i][DH::dimension] = std::sin(2*deal_II_numbers::PI * i/n_patches_per_circle); }; unsigned int cell_number = 0; - typename std::vector< ::DataOutBase::Patch >::iterator + typename std::vector< ::DataOutBase::Patch >::iterator patch = this->patches.begin(); cell_iterator cell=first_cell(); @@ -111,7 +114,7 @@ void DataOutRotation::build_some_patches (Data &data) // from the vertices of the // cell, which has one // dimension less, however. - switch (dim) + switch (DH::dimension) { case 1: { @@ -131,10 +134,10 @@ void DataOutRotation::build_some_patches (Data &data) case 2: { for (unsigned int vertex=0; - vertex::vertices_per_cell; + vertex::vertices_per_cell; ++vertex) { - const Point v = cell->vertex(vertex); + const Point v = cell->vertex(vertex); // make sure that the // radial variable does @@ -147,9 +150,9 @@ void DataOutRotation::build_some_patches (Data &data) patch->vertices[vertex] = v(0) * angle_directions[angle]; patch->vertices[vertex][0] = v(1); - patch->vertices[vertex+GeometryInfo::vertices_per_cell] + patch->vertices[vertex+GeometryInfo::vertices_per_cell] = v(0) * angle_directions[angle+1]; - patch->vertices[vertex+GeometryInfo::vertices_per_cell][0] + patch->vertices[vertex+GeometryInfo::vertices_per_cell][0] = v(1); }; @@ -165,7 +168,7 @@ void DataOutRotation::build_some_patches (Data &data) if (data.n_datasets > 0) { x_fe_patch_values.reinit (cell); - const FEValues &fe_patch_values + const FEValues &fe_patch_values = x_fe_patch_values.get_present_fe_values (); // first fill dof_data @@ -176,7 +179,7 @@ void DataOutRotation::build_some_patches (Data &data) this->dof_data[dataset]->get_function_values (fe_patch_values, data.patch_values); - switch (dim) + switch (DH::dimension) { case 1: for (unsigned int x=0; x::build_some_patches (Data &data) for (unsigned int component=0; component::build_some_patches (Data &data) { const double value = this->cell_data[dataset]->get_cell_data_value (cell_number); - switch (dim) + switch (DH::dimension) { case 1: for (unsigned int x=0; x::build_some_patches (Data &data) -#if deal_II_dimension == 3 +#else -template <> -void DataOutRotation<3,DoFHandler>::build_some_patches (Data &) +template +void DataOutRotation::build_some_patches (Data&) { // would this function make any // sense after all? who would want @@ -313,15 +316,19 @@ void DataOutRotation<3,DoFHandler>::build_some_patches (Data &) -template class DH> +template void DataOutRotation::build_patches (const unsigned int n_patches_per_circle, const unsigned int n_subdivisions, const unsigned int n_threads_) { + // Check consistency of redundant + // template parameter + Assert (dim==DH::dimension, ExcDimensionMismatch(dim, DH::dimension)); + Assert (n_subdivisions >= 1, ExcInvalidNumberOfSubdivisions(n_subdivisions)); - typedef DataOut_DoFData BaseClass; + typedef DataOut_DoFData BaseClass; Assert (this->dofs != 0, typename BaseClass::ExcNoDoFHandlerSelected()); const unsigned int n_threads = (DEAL_II_USE_MT ? n_threads_ : 1); @@ -331,7 +338,7 @@ void DataOutRotation::build_patches (const unsigned int n_patches_per_ci // actually has the points on this // patch QTrapez<1> q_trapez; - QIterated patch_points (q_trapez, n_subdivisions); + QIterated patch_points (q_trapez, n_subdivisions); const unsigned int n_q_points = patch_points.n_quadrature_points; const unsigned int n_components = this->dofs->get_fe().n_components(); @@ -341,7 +348,7 @@ void DataOutRotation::build_patches (const unsigned int n_patches_per_ci // clear the patches array if (true) { - std::vector< ::DataOutBase::Patch > dummy; + std::vector< ::DataOutBase::Patch > dummy; this->patches.swap (dummy); }; @@ -381,7 +388,7 @@ void DataOutRotation::build_patches (const unsigned int n_patches_per_ci // values. note that the evaluation // points on the cell have to be // repeated in angular direction - ::DataOutBase::Patch default_patch; + ::DataOutBase::Patch default_patch; default_patch.n_subdivisions = n_subdivisions; default_patch.data.reinit (n_datasets, n_q_points * (n_subdivisions+1)); @@ -404,7 +411,7 @@ void DataOutRotation::build_patches (const unsigned int n_patches_per_ci -template class DH> +template typename DataOutRotation::cell_iterator DataOutRotation::first_cell () { @@ -412,18 +419,18 @@ DataOutRotation::first_cell () } -template class DH> +template typename DataOutRotation::cell_iterator DataOutRotation::next_cell (const cell_iterator &cell) { // convert the iterator to an // active_iterator and advance // this to the next active cell - typename DH::active_cell_iterator active_cell = cell; + typename DH::active_cell_iterator active_cell = cell; ++active_cell; return active_cell; } // explicit instantiations -template class DataOutRotation; +template class DataOutRotation >; diff --git a/deal.II/deal.II/source/numerics/data_out_stack.cc b/deal.II/deal.II/source/numerics/data_out_stack.cc index 851bb54a8c..a07d616250 100644 --- a/deal.II/deal.II/source/numerics/data_out_stack.cc +++ b/deal.II/deal.II/source/numerics/data_out_stack.cc @@ -28,7 +28,7 @@ #include -template class DH> +template unsigned int DataOutStack::DataVector::memory_consumption () const { @@ -38,12 +38,12 @@ DataOutStack::DataVector::memory_consumption () const -template class DH> +template DataOutStack::~DataOutStack () {} -template class DH> +template void DataOutStack::new_parameter_value (const double p, const double dp) { @@ -67,14 +67,18 @@ void DataOutStack::new_parameter_value (const double p, } -template class DH> -void DataOutStack::attach_dof_handler (const DH &dof) +template +void DataOutStack::attach_dof_handler (const DH& dof) { + // Check consistency of redundant + // template parameter + Assert (dim==DH::dimension, ExcDimensionMismatch(dim, DH::dimension)); + dof_handler = &dof; } -template class DH> +template void DataOutStack::declare_data_vector (const std::string &name, const VectorType vector_type) { @@ -84,7 +88,7 @@ void DataOutStack::declare_data_vector (const std::string &name, } -template class DH> +template void DataOutStack::declare_data_vector (const std::vector &names, const VectorType vector_type) { @@ -124,7 +128,7 @@ void DataOutStack::declare_data_vector (const std::vector & } -template class DH> +template template void DataOutStack::add_data_vector (const Vector &vec, const std::string &name) @@ -157,7 +161,7 @@ void DataOutStack::add_data_vector (const Vector &vec, } -template class DH> +template template void DataOutStack::add_data_vector (const Vector &vec, const std::vector &names) @@ -224,7 +228,7 @@ void DataOutStack::add_data_vector (const Vector &vec, } -template class DH> +template void DataOutStack::build_patches (const unsigned int n_subdivisions) { // this is mostly copied from the @@ -241,7 +245,7 @@ void DataOutStack::build_patches (const unsigned int n_subdivisions) // create patches of and make sure // there is enough memory for that unsigned int n_patches = 0; - for (typename DH::active_cell_iterator + for (typename DH::active_cell_iterator cell=dof_handler->begin_active(); cell != dof_handler->end(); ++cell) ++n_patches; @@ -289,7 +293,7 @@ void DataOutStack::build_patches (const unsigned int n_subdivisions) typename std::vector< ::DataOutBase::Patch >::iterator patch = patches.begin() + (patches.size()-n_patches); unsigned int cell_number = 0; - for (typename DH::active_cell_iterator cell=dof_handler->begin_active(); + for (typename DH::active_cell_iterator cell=dof_handler->begin_active(); cell != dof_handler->end(); ++cell, ++patch, ++cell_number) { Assert (patch != patches.end(), ExcInternalError()); @@ -399,7 +403,7 @@ void DataOutStack::build_patches (const unsigned int n_subdivisions) } -template class DH> +template void DataOutStack::finish_parameter_value () { // release lock on dof handler @@ -415,7 +419,7 @@ void DataOutStack::finish_parameter_value () -template class DH> +template unsigned int DataOutStack::memory_consumption () const { @@ -430,7 +434,7 @@ DataOutStack::memory_consumption () const -template class DH> +template const std::vector< ::DataOutBase::Patch > & DataOutStack::get_patches () const { @@ -439,7 +443,7 @@ DataOutStack::get_patches () const -template class DH> +template std::vector DataOutStack::get_dataset_names () const { std::vector names; @@ -455,24 +459,20 @@ std::vector DataOutStack::get_dataset_names () const // explicit instantiations -template class DataOutStack; +template class DataOutStack >; -template void DataOutStack:: +template void DataOutStack >:: add_data_vector (const Vector &vec, const std::string &name); -template void DataOutStack:: +template void DataOutStack >:: add_data_vector (const Vector &vec, const std::string &name); -template class DataOutStack; -template void DataOutStack:: +template class DataOutStack >; +template void DataOutStack >:: add_data_vector (const Vector &vec, const std::string &name); -template void DataOutStack:: +template void DataOutStack >:: add_data_vector (const Vector &vec, const std::string &name); - -template void DataOutStack:: -add_data_vector (const Vector &vec, - const std::vector &names);