From 3555fc3e7744b6a8b19e8d40369d7ec632d69e3c Mon Sep 17 00:00:00 2001 From: kanschat Date: Mon, 5 Jan 2009 20:10:47 +0000 Subject: [PATCH] eliminate offset from old Mapping::transform functions git-svn-id: https://svn.dealii.org/trunk@18084 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/include/fe/fe_poly.templates.h | 10 ++--- deal.II/deal.II/source/fe/fe_nedelec.cc | 17 ++++---- deal.II/deal.II/source/fe/fe_poly_tensor.cc | 43 +++++++++---------- .../deal.II/source/fe/mapping_cartesian.cc | 12 ++++++ deal.II/deal.II/source/fe/mapping_q.cc | 20 +++++---- deal.II/deal.II/source/fe/mapping_q1.cc | 12 +++++- 6 files changed, 70 insertions(+), 44 deletions(-) diff --git a/deal.II/deal.II/include/fe/fe_poly.templates.h b/deal.II/deal.II/include/fe/fe_poly.templates.h index a89101565b..1b6e3dd802 100644 --- a/deal.II/deal.II/include/fe/fe_poly.templates.h +++ b/deal.II/deal.II/include/fe/fe_poly.templates.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2006, 2007, 2008 by the deal.II authors +// Copyright (C) 2006, 2007, 2008, 2009 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -565,8 +565,8 @@ FE_Poly::fill_fe_face_values (const Mapping Assert (data.shape_gradients[k].size() + offset <= fe_data.shape_gradients[k].size(), ExcInternalError()); - mapping.transform_covariant(fe_data.shape_gradients[k], offset, - data.shape_gradients[k], + mapping.transform_covariant(make_slice(fe_data.shape_gradients[k], offset, quadrature.size()), + 0, data.shape_gradients[k], mapping_data); } } @@ -686,8 +686,8 @@ FE_Poly::fill_fe_subface_values (const Mapping Assert (data.shape_gradients[k].size() + offset <= fe_data.shape_gradients[k].size(), ExcInternalError()); - mapping.transform_covariant(fe_data.shape_gradients[k], offset, - data.shape_gradients[k], + mapping.transform_covariant(make_slice(fe_data.shape_gradients[k], offset, quadrature.size()), + 0, data.shape_gradients[k], mapping_data); } } diff --git a/deal.II/deal.II/source/fe/fe_nedelec.cc b/deal.II/deal.II/source/fe/fe_nedelec.cc index 9f6373f773..95a5cba93b 100644 --- a/deal.II/deal.II/source/fe/fe_nedelec.cc +++ b/deal.II/deal.II/source/fe/fe_nedelec.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors +// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -1178,7 +1178,8 @@ FE_Nedelec::fill_fe_face_values (const Mapping { // first transform shape // values... - mapping.transform_covariant(fe_data.shape_values[k], offset, + mapping.transform_covariant(make_slice(fe_data.shape_values[k], offset, n_q_points), + 0, shape_values, mapping_data); @@ -1235,8 +1236,8 @@ FE_Nedelec::fill_fe_face_values (const Mapping // little in between // // do first transformation - mapping.transform_covariant(fe_data.shape_gradients[k], offset, - shape_grads1, + mapping.transform_covariant(make_slice(fe_data.shape_gradients[k], offset, n_q_points), + 0, shape_grads1, mapping_data); // transpose matrix for (unsigned int q=0; q::fill_fe_subface_values (const Mapping { // first transform shape // values... - mapping.transform_covariant(fe_data.shape_values[k], offset, - shape_values, + mapping.transform_covariant(make_slice(fe_data.shape_values[k], offset, n_q_points), + 0, shape_values, mapping_data); // then copy over to target: @@ -1381,8 +1382,8 @@ FE_Nedelec::fill_fe_subface_values (const Mapping // little in between // // do first transformation - mapping.transform_covariant(fe_data.shape_gradients[k], offset, - shape_grads1, + mapping.transform_covariant(make_slice(fe_data.shape_gradients[k], offset, n_q_points), + 0, shape_grads1, mapping_data); // transpose matrix for (unsigned int q=0; q::fill_fe_face_values ( // for transformation std::vector > shape_values (n_q_points); if (mapping_type == covariant) - mapping.transform_covariant(fe_data.shape_values[i], offset, - shape_values, mapping_data); + mapping.transform_covariant(make_slice(fe_data.shape_values[i], offset, n_q_points), + 0, shape_values, mapping_data); else - mapping.transform_contravariant(fe_data.shape_values[i], offset, - shape_values, mapping_data); + mapping.transform_contravariant(make_slice(fe_data.shape_values[i], offset, n_q_points), + 0, shape_values, mapping_data); // then copy over to target: for (unsigned int k=0; k::fill_fe_face_values ( case independent: case independent_on_cartesian: { - mapping.transform_covariant(fe_data.shape_grads[i], offset, - shape_grads1, mapping_data); + mapping.transform_covariant(make_slice(fe_data.shape_grads[i], offset, n_q_points), + 0, shape_grads1, mapping_data); for (unsigned int k=0; k::fill_fe_face_values ( case covariant: { - mapping.transform_covariant(fe_data.shape_grads[i], offset, - shape_grads1, - mapping_data); + mapping.transform_covariant(make_slice(fe_data.shape_grads[i], offset, n_q_points), + 0, shape_grads1, mapping_data); for (unsigned int q=0; q::fill_fe_face_values ( case contravariant: { - mapping.transform_covariant(fe_data.shape_grads[i], offset, - shape_grads1, + mapping.transform_covariant(make_slice(fe_data.shape_grads[i], offset, n_q_points), + 0, shape_grads1, mapping_data); mapping.transform_contravariant(shape_grads1, 0, @@ -778,11 +777,11 @@ FE_PolyTensor::fill_fe_subface_values ( // transformation std::vector > shape_values (n_q_points); if (mapping_type == covariant) - mapping.transform_covariant(fe_data.shape_values[i], offset, - shape_values, mapping_data); + mapping.transform_covariant(make_slice(fe_data.shape_values[i], offset, n_q_points), + 0, shape_values, mapping_data); else - mapping.transform_contravariant(fe_data.shape_values[i], offset, - shape_values, mapping_data); + mapping.transform_contravariant(make_slice(fe_data.shape_values[i], offset, n_q_points), + 0, shape_values, mapping_data); // then copy over to target: for (unsigned int k=0; k::fill_fe_subface_values ( case independent: case independent_on_cartesian: { - mapping.transform_covariant(fe_data.shape_grads[i], offset, - shape_grads1, mapping_data); + mapping.transform_covariant(make_slice(fe_data.shape_grads[i], offset, n_q_points), + 0, shape_grads1, mapping_data); for (unsigned int k=0; k::fill_fe_subface_values ( case covariant: { - mapping.transform_covariant(fe_data.shape_grads[i], offset, - shape_grads1, + mapping.transform_covariant(make_slice(fe_data.shape_grads[i], offset, n_q_points), + 0, shape_grads1, mapping_data); for (unsigned int q=0; q::fill_fe_subface_values ( case contravariant: { - mapping.transform_covariant(fe_data.shape_grads[i], offset, - shape_grads1, + mapping.transform_covariant(make_slice(fe_data.shape_grads[i], offset, n_q_points), + 0, shape_grads1, mapping_data); mapping.transform_contravariant(shape_grads1, 0, diff --git a/deal.II/deal.II/source/fe/mapping_cartesian.cc b/deal.II/deal.II/source/fe/mapping_cartesian.cc index ffb5c9ab23..ff32562376 100644 --- a/deal.II/deal.II/source/fe/mapping_cartesian.cc +++ b/deal.II/deal.II/source/fe/mapping_cartesian.cc @@ -556,6 +556,9 @@ MappingCartesian::transform_covariant ( VectorSlice > > output, const typename Mapping::InternalDataBase &mapping_data) const { + Assert (offset == 0, ExcInternalError()); + AssertDimension (input.size(), output.size()); + const InternalData &data = dynamic_cast (mapping_data); Assert (data.update_flags & update_covariant_transformation, @@ -580,6 +583,9 @@ MappingCartesian::transform_covariant ( VectorSlice > > output, const typename Mapping::InternalDataBase &mapping_data) const { + Assert (offset == 0, ExcInternalError()); + AssertDimension (input.size(), output.size()); + const InternalData &data = dynamic_cast (mapping_data); Assert (data.update_flags & update_covariant_transformation, @@ -605,6 +611,9 @@ MappingCartesian::transform_contravariant ( VectorSlice > > output, const typename Mapping::InternalDataBase &mapping_data) const { + Assert (offset == 0, ExcInternalError()); + AssertDimension (input.size(), output.size()); + // convert data object to internal // data for this class. fails with // an exception if that is not @@ -633,6 +642,9 @@ MappingCartesian::transform_contravariant ( VectorSlice > > output, const typename Mapping::InternalDataBase &mapping_data) const { + Assert (offset == 0, ExcInternalError()); + AssertDimension (input.size(), output.size()); + // convert data object to internal // data for this class. fails with // an exception if that is not diff --git a/deal.II/deal.II/source/fe/mapping_q.cc b/deal.II/deal.II/source/fe/mapping_q.cc index 48d14df0e2..45892480b5 100644 --- a/deal.II/deal.II/source/fe/mapping_q.cc +++ b/deal.II/deal.II/source/fe/mapping_q.cc @@ -1254,12 +1254,13 @@ MappingQ::transform_covariant ( VectorSlice > > output, const typename Mapping::InternalDataBase &mapping_data) const { + Assert (offset == 0, ExcInternalError()); + AssertDimension (input.size(), output.size()); + const typename MappingQ1::InternalData *q1_data = dynamic_cast::InternalData *> (&mapping_data); Assert(q1_data!=0, ExcInternalError()); - Assert (output.size() + offset <= input.size(), ExcInternalError()); - typename std::vector >::const_iterator tensor; if (q1_data->is_mapping_q1_data) @@ -1289,12 +1290,13 @@ MappingQ::transform_covariant ( VectorSlice > > output, const typename Mapping::InternalDataBase &mapping_data) const { + Assert (offset == 0, ExcInternalError()); + AssertDimension (input.size(), output.size()); + const typename MappingQ1::InternalData *q1_data = dynamic_cast::InternalData *> (&mapping_data); Assert(q1_data!=0, ExcInternalError()); - Assert (output.size() + offset <= input.size(), ExcInternalError()); - typename std::vector >::const_iterator tensor; if (q1_data->is_mapping_q1_data) @@ -1324,12 +1326,13 @@ MappingQ::transform_contravariant ( VectorSlice > > output, const typename Mapping::InternalDataBase &mapping_data) const { + Assert (offset == 0, ExcInternalError()); + AssertDimension (input.size(), output.size()); + const typename MappingQ1::InternalData *q1_data = dynamic_cast::InternalData *> (&mapping_data); Assert(q1_data!=0, ExcInternalError()); - Assert (output.size() + offset <= input.size(), ExcInternalError()); - typename std::vector >::const_iterator tensor; if (q1_data->is_mapping_q1_data) @@ -1359,12 +1362,13 @@ MappingQ::transform_contravariant ( VectorSlice > > output, const typename Mapping::InternalDataBase &mapping_data) const { + Assert (offset == 0, ExcInternalError()); + AssertDimension (input.size(), output.size()); + const typename MappingQ1::InternalData *q1_data = dynamic_cast::InternalData *> (&mapping_data); Assert(q1_data!=0, ExcInternalError()); - Assert (output.size() + offset <= input.size(), ExcInternalError()); - typename std::vector >::const_iterator tensor; if (q1_data->is_mapping_q1_data) diff --git a/deal.II/deal.II/source/fe/mapping_q1.cc b/deal.II/deal.II/source/fe/mapping_q1.cc index 17f59a091e..83aed8f269 100644 --- a/deal.II/deal.II/source/fe/mapping_q1.cc +++ b/deal.II/deal.II/source/fe/mapping_q1.cc @@ -1216,6 +1216,9 @@ MappingQ1::transform_covariant ( VectorSlice > > output, const typename Mapping::InternalDataBase &mapping_data) const { + Assert (offset == 0, ExcInternalError()); + AssertDimension (input.size(), output.size()); + // ensure that the following cast is really correct: Assert (dynamic_cast(&mapping_data) != 0, ExcInternalError()); @@ -1241,7 +1244,10 @@ MappingQ1<1,2>::transform_covariant ( VectorSlice > > output, const Mapping<1,2>::InternalDataBase &mapping_data) const { - // ensure that the following cast is really correct: + Assert (offset == 0, ExcInternalError()); + AssertDimension (input.size(), output.size()); + + // ensure that the following cast is really correct: Assert (dynamic_cast(&mapping_data) != 0, ExcInternalError()); const InternalData &data = static_cast(mapping_data); @@ -1273,6 +1279,8 @@ MappingQ1<2,3>::transform_covariant ( VectorSlice > > output, const Mapping<2,3>::InternalDataBase &mapping_data) const { + Assert (offset == 0, ExcInternalError()); + AssertDimension (input.size(), output.size()); // ensure that the following cast is really correct: Assert (dynamic_cast(&mapping_data) != 0, ExcInternalError()); @@ -1305,6 +1313,8 @@ MappingQ1::transform_covariant ( VectorSlice > > output, const typename Mapping::InternalDataBase &mapping_data) const { + Assert (offset == 0, ExcInternalError()); + AssertDimension (input.size(), output.size()); // ensure that the following cast is really correct: Assert (dynamic_cast(&mapping_data) != 0, ExcInternalError()); -- 2.39.5