From: Wolfgang Bangerth Date: Fri, 4 Sep 2015 23:13:00 +0000 (-0500) Subject: Simplify code. X-Git-Tag: v8.4.0-rc2~474^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4ea9fb106d436e7c866a1f82e196ea5c9de3225;p=dealii.git Simplify code. --- diff --git a/source/fe/mapping_q.cc b/source/fe/mapping_q.cc index 207cec2ac8..28c8dedf2f 100644 --- a/source/fe/mapping_q.cc +++ b/source/fe/mapping_q.cc @@ -873,23 +873,18 @@ transform (const VectorSlice > > input, VectorSlice > > output) const { AssertDimension (input.size(), output.size()); - // The data object may be just a MappingQ1::InternalData, so we have to test - // for this first. - const typename MappingQ1::InternalData *q1_data = - dynamic_cast::InternalData *> (&mapping_data); - Assert(q1_data!=0, ExcInternalError()); + Assert ((dynamic_cast::InternalData *> (&mapping_data) + != 0), + ExcInternalError()); // If it is a genuine MappingQ::InternalData, we have to test further + // whether we should in fact work on the Q1 portion of it if (const InternalData *data = dynamic_cast(&mapping_data)) - { - // If we only use the Q1-portion, we have to extract that data object - if (data->use_mapping_q1_on_current_cell) - q1_data = data->mapping_q1_data.get(); - } + if (data->use_mapping_q1_on_current_cell) + return MappingQ1::transform (input, mapping_type, *data->mapping_q1_data, output); - // Now, q1_data should have the right tensors in it and we call the base - // class's transform function - MappingQ1::transform(input, mapping_type, *q1_data, output); + // otherwise just stick with what we already had + MappingQ1::transform(input, mapping_type, mapping_data, output); } @@ -903,23 +898,18 @@ transform (const VectorSlice VectorSlice > > output) const { AssertDimension (input.size(), output.size()); - // The data object may be just a MappingQ1::InternalData, so we have to test - // for this first. - const typename MappingQ1::InternalData *q1_data = - dynamic_cast::InternalData *> (&mapping_data); - Assert(q1_data!=0, ExcInternalError()); + Assert ((dynamic_cast::InternalData *> (&mapping_data) + != 0), + ExcInternalError()); // If it is a genuine MappingQ::InternalData, we have to test further + // whether we should in fact work on the Q1 portion of it if (const InternalData *data = dynamic_cast(&mapping_data)) - { - // If we only use the Q1-portion, we have to extract that data object - if (data->use_mapping_q1_on_current_cell) - q1_data = data->mapping_q1_data.get(); - } + if (data->use_mapping_q1_on_current_cell) + return MappingQ1::transform (input, mapping_type, *data->mapping_q1_data, output); - // Now, q1_data should have the right tensors in it and we call the base - // class's transform function - MappingQ1::transform(input, mapping_type, *q1_data, output); + // otherwise just stick with what we already had + MappingQ1::transform(input, mapping_type, mapping_data, output); } @@ -931,23 +921,18 @@ transform (const VectorSlice > > input, VectorSlice > > output) const { AssertDimension (input.size(), output.size()); - // The data object may be just a MappingQ1::InternalData, so we have to test - // for this first. - const typename MappingQ1::InternalData *q1_data = - dynamic_cast::InternalData *> (&mapping_data); - Assert(q1_data!=0, ExcInternalError()); + Assert ((dynamic_cast::InternalData *> (&mapping_data) + != 0), + ExcInternalError()); // If it is a genuine MappingQ::InternalData, we have to test further + // whether we should in fact work on the Q1 portion of it if (const InternalData *data = dynamic_cast(&mapping_data)) - { - // If we only use the Q1-portion, we have to extract that data object - if (data->use_mapping_q1_on_current_cell) - q1_data = data->mapping_q1_data.get(); - } + if (data->use_mapping_q1_on_current_cell) + return MappingQ1::transform (input, mapping_type, *data->mapping_q1_data, output); - // Now, q1_data should have the right tensors in it and we call the base - // class's transform function - MappingQ1::transform(input, mapping_type, *q1_data, output); + // otherwise just stick with what we already had + MappingQ1::transform(input, mapping_type, mapping_data, output); } @@ -961,23 +946,18 @@ transform (const VectorSlice VectorSlice > > output) const { AssertDimension (input.size(), output.size()); - // The data object may be just a MappingQ1::InternalData, so we have to test - // for this first. - const typename MappingQ1::InternalData *q1_data = - dynamic_cast::InternalData *> (&mapping_data); - Assert(q1_data!=0, ExcInternalError()); + Assert ((dynamic_cast::InternalData *> (&mapping_data) + != 0), + ExcInternalError()); // If it is a genuine MappingQ::InternalData, we have to test further + // whether we should in fact work on the Q1 portion of it if (const InternalData *data = dynamic_cast(&mapping_data)) - { - // If we only use the Q1-portion, we have to extract that data object - if (data->use_mapping_q1_on_current_cell) - q1_data = data->mapping_q1_data.get(); - } + if (data->use_mapping_q1_on_current_cell) + return MappingQ1::transform (input, mapping_type, *data->mapping_q1_data, output); - // Now, q1_data should have the right tensors in it and we call the base - // class's transform function - MappingQ1::transform(input, mapping_type, *q1_data, output); + // otherwise just stick with what we already had + MappingQ1::transform(input, mapping_type, mapping_data, output); } @@ -989,23 +969,18 @@ transform (const VectorSlice > > input, VectorSlice > > output) const { AssertDimension (input.size(), output.size()); - // The data object may be just a MappingQ1::InternalData, so we have to test - // for this first. - const typename MappingQ1::InternalData *q1_data = - dynamic_cast::InternalData *> (&mapping_data); - Assert(q1_data!=0, ExcInternalError()); + Assert ((dynamic_cast::InternalData *> (&mapping_data) + != 0), + ExcInternalError()); // If it is a genuine MappingQ::InternalData, we have to test further + // whether we should in fact work on the Q1 portion of it if (const InternalData *data = dynamic_cast(&mapping_data)) - { - // If we only use the Q1-portion, we have to extract that data object - if (data->use_mapping_q1_on_current_cell) - q1_data = data->mapping_q1_data.get(); - } + if (data->use_mapping_q1_on_current_cell) + return MappingQ1::transform (input, mapping_type, *data->mapping_q1_data, output); - // Now, q1_data should have the right tensors in it and we call the base - // class's transform function - MappingQ1::transform(input, mapping_type, *q1_data, output); + // otherwise just stick with what we already had + MappingQ1::transform(input, mapping_type, mapping_data, output); }