From: Wolfgang Bangerth Date: Wed, 6 May 1998 16:03:56 +0000 (+0000) Subject: Move the dVector class closer to the STL's vector<>. X-Git-Tag: v8.0.0~22991 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=164c624573adfb56ebe3ced81210fc57cc713ecf;p=dealii.git Move the dVector class closer to the STL's vector<>. git-svn-id: https://svn.dealii.org/trunk@263 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/dofs/dof_accessor.cc b/deal.II/deal.II/source/dofs/dof_accessor.cc index e2e620dc0a..18b5c5416f 100644 --- a/deal.II/deal.II/source/dofs/dof_accessor.cc +++ b/deal.II/deal.II/source/dofs/dof_accessor.cc @@ -316,7 +316,7 @@ DoFCellAccessor<1>::get_dof_values (const dVector &values, Assert (&dof_handler->get_selected_fe() != 0, ExcInvalidObject()); Assert (dof_values.size() == dof_handler->get_selected_fe().total_dofs, ExcVectorDoesNotMatch()); - Assert (values.n() == dof_handler->n_dofs(), + Assert (values.size() == dof_handler->n_dofs(), ExcVectorDoesNotMatch()); vector::iterator next_dof_value=dof_values.begin(); @@ -337,7 +337,7 @@ DoFCellAccessor<2>::get_dof_values (const dVector &values, Assert (&dof_handler->get_selected_fe() != 0, ExcInvalidObject()); Assert (dof_values.size() == dof_handler->get_selected_fe().total_dofs, ExcVectorDoesNotMatch()); - Assert (values.n() == dof_handler->n_dofs(), + Assert (values.size() == dof_handler->n_dofs(), ExcVectorDoesNotMatch()); vector::iterator next_dof_value=dof_values.begin(); diff --git a/deal.II/deal.II/source/dofs/dof_constraints.cc b/deal.II/deal.II/source/dofs/dof_constraints.cc index c418c3cfce..eeab1152af 100644 --- a/deal.II/deal.II/source/dofs/dof_constraints.cc +++ b/deal.II/deal.II/source/dofs/dof_constraints.cc @@ -505,7 +505,7 @@ void ConstraintMatrix::condense (dSMatrix &uncondensed) const { void ConstraintMatrix::condense (const dVector &uncondensed, dVector &condensed) const { Assert (sorted == true, ExcMatrixNotClosed()); - Assert (condensed.n()+n_constraints() == uncondensed.n(), + Assert (condensed.size()+n_constraints() == uncondensed.size(), ExcWrongDimension()); // store for each line of the vector @@ -514,11 +514,11 @@ void ConstraintMatrix::condense (const dVector &uncondensed, // -1, this line will be condensed away vector new_line; - new_line.reserve (uncondensed.n()); + new_line.reserve (uncondensed.size()); vector::const_iterator next_constraint = lines.begin(); unsigned int shift = 0; - unsigned int n_rows = uncondensed.n(); + unsigned int n_rows = uncondensed.size(); if (next_constraint == lines.end()) // if no constraint is to be handled @@ -553,7 +553,7 @@ void ConstraintMatrix::condense (const dVector &uncondensed, // only evaluated so often as there are // entries in new_line[*] which tells us // which constraints exist - for (unsigned int row=0; row::const_iterator next_constraint = lines.begin(); - for (unsigned int row=0; rowline) // line must be distributed { @@ -605,7 +605,7 @@ void ConstraintMatrix::condense (dVector &vec) const { void ConstraintMatrix::distribute (const dVector &condensed, dVector &uncondensed) const { Assert (sorted == true, ExcMatrixNotClosed()); - Assert (condensed.n()+n_constraints() == uncondensed.n(), + Assert (condensed.size()+n_constraints() == uncondensed.size(), ExcWrongDimension()); // store for each line of the new vector @@ -614,11 +614,11 @@ void ConstraintMatrix::distribute (const dVector &condensed, // -1, this line was condensed away vector old_line; - old_line.reserve (uncondensed.n()); + old_line.reserve (uncondensed.size()); vector::const_iterator next_constraint = lines.begin(); unsigned int shift = 0; - unsigned int n_rows = uncondensed.n(); + unsigned int n_rows = uncondensed.size(); if (next_constraint == lines.end()) // if no constraint is to be handled @@ -653,7 +653,7 @@ void ConstraintMatrix::distribute (const dVector &condensed, // only evaluated so often as there are // entries in new_line[*] which tells us // which constraints exist - for (unsigned int line=0; line::max_transfer_entries (const unsigned int max_level_d template void DoFHandler::distribute_cell_to_dof_vector (const dVector &cell_data, dVector &dof_data) const { - Assert (cell_data.n()==tria->n_active_cells(), - ExcWrongSize (cell_data.n(), tria->n_active_cells())); + Assert (cell_data.size()==tria->n_active_cells(), + ExcWrongSize (cell_data.size(), tria->n_active_cells())); // assign the right size to the output vector dof_data.reinit (n_dofs()); diff --git a/deal.II/deal.II/source/grid/tria.cc b/deal.II/deal.II/source/grid/tria.cc index 0a2daf6ca7..70019f75d2 100644 --- a/deal.II/deal.II/source/grid/tria.cc +++ b/deal.II/deal.II/source/grid/tria.cc @@ -1731,11 +1731,11 @@ void Triangulation<2>::print_gnuplot (ostream &out, template void Triangulation::refine (const dVector &criteria, const double threshold) { - Assert (criteria.n() == n_active_cells(), - ExcInvalidVectorSize(criteria.n(), n_active_cells())); + Assert (criteria.size() == n_active_cells(), + ExcInvalidVectorSize(criteria.size(), n_active_cells())); active_cell_iterator cell = begin_active(); - const unsigned int n_cells = criteria.n(); + const unsigned int n_cells = criteria.size(); for (unsigned int index=0; index threshold) @@ -1749,12 +1749,12 @@ void Triangulation::refine_fixed_number (const dVector &criteria, const double fraction) { dVector tmp(criteria); nth_element (tmp.begin(), - tmp.begin()+static_cast(fraction*tmp.n()), + tmp.begin()+static_cast(fraction*tmp.size()), tmp.end(), greater()); refine (criteria, *(tmp.begin() + - static_cast(fraction*tmp.n()))); + static_cast(fraction*tmp.size()))); }; diff --git a/deal.II/deal.II/source/numerics/assembler.cc b/deal.II/deal.II/source/numerics/assembler.cc index 475545b464..d016ae11cb 100644 --- a/deal.II/deal.II/source/numerics/assembler.cc +++ b/deal.II/deal.II/source/numerics/assembler.cc @@ -90,7 +90,7 @@ Assembler::Assembler (Triangulation *tria, Assert (matrix.n() == dof_handler->n_dofs(), ExcInvalidData()); Assert (((AssemblerData*)local_data)->fe == dof_handler->get_selected_fe(), ExcInvalidData()); - Assert (rhs_vector.n() == dof_handler->n_dofs(), + Assert (rhs_vector.size() == dof_handler->n_dofs(), ExcInvalidData()); }; diff --git a/deal.II/deal.II/source/numerics/base.cc b/deal.II/deal.II/source/numerics/base.cc index b411e92bcd..13b5f823f3 100644 --- a/deal.II/deal.II/source/numerics/base.cc +++ b/deal.II/deal.II/source/numerics/base.cc @@ -145,7 +145,7 @@ void ProblemBase::solve () { double tolerance = 1.e-16; Control control1(max_iter,tolerance); - PrimitiveVectorMemory memory(right_hand_side.n()); + PrimitiveVectorMemory memory(right_hand_side.size()); CG cg(control1,memory); // solve diff --git a/deal.II/lac/include/lac/dvector.h b/deal.II/lac/include/lac/dvector.h index 6eb44dc1d6..692986fc06 100644 --- a/deal.II/lac/include/lac/dvector.h +++ b/deal.II/lac/include/lac/dvector.h @@ -151,7 +151,7 @@ class dVector : public VectorBase * Inquire Dimension. returns Dimension , * INLINE */ - unsigned int n () const; + unsigned int size () const; /** * Make the #dVector# class a bit like the @@ -388,7 +388,7 @@ class dVector : public VectorBase -inline unsigned int dVector::n () const +inline unsigned int dVector::size () const { return dim; } diff --git a/deal.II/lac/source/dfmatrix.cc b/deal.II/lac/source/dfmatrix.cc index dd42cbabed..b2b3340f76 100644 --- a/deal.II/lac/source/dfmatrix.cc +++ b/deal.II/lac/source/dfmatrix.cc @@ -49,8 +49,8 @@ void dFMatrix::reinit (const unsigned int mm, const unsigned int nn) void dFMatrix::vmult (dVector& dst, const dVector& src, const bool adding) const { - Assert(dst.n() == m(), ExcDimensionMismatch(dst.n(), m())); - Assert(src.n() == n(), ExcDimensionMismatch(src.n(), n())); + Assert(dst.size() == m(), ExcDimensionMismatch(dst.size(), m())); + Assert(src.size() == n(), ExcDimensionMismatch(src.size(), n())); double s; if ((n()==3) && (m()==3)) @@ -173,8 +173,8 @@ void dFMatrix::vmult (dVector& dst, const dVector& src, void dFMatrix::gsmult (dVector& dst, const dVector& src, const iVector& gl) const { Assert(n() == m(), ExcNotQuadratic()); - Assert(dst.n() == n(), ExcDimensionMismatch(dst.n(), n())); - Assert(src.n() == n(), ExcDimensionMismatch(src.n(), n())); + Assert(dst.size() == n(), ExcDimensionMismatch(dst.size(), n())); + Assert(src.size() == n(), ExcDimensionMismatch(src.size(), n())); Assert(gl.n() == n(), ExcDimensionMismatch(gl.n(), n())); double s; @@ -303,8 +303,8 @@ void dFMatrix::gsmult (dVector& dst, const dVector& src, const iVector& gl) cons void dFMatrix::Tvmult (dVector& dst, const dVector& src, const bool adding) const { - Assert(dst.n() == n(), ExcDimensionMismatch(dst.n(), n())); - Assert(src.n() == m(), ExcDimensionMismatch(src.n(), m())); + Assert(dst.size() == n(), ExcDimensionMismatch(dst.size(), n())); + Assert(src.size() == m(), ExcDimensionMismatch(src.size(), m())); unsigned int i,j; double s; @@ -323,9 +323,9 @@ void dFMatrix::Tvmult (dVector& dst, const dVector& src, const bool adding) cons double dFMatrix::residual (dVector& dst, const dVector& src, const dVector& right) const { - Assert(dst.n() == m(), ExcDimensionMismatch(dst.n(), m())); - Assert(src.n() == n(), ExcDimensionMismatch(src.n(), n())); - Assert(right.n() == m(), ExcDimensionMismatch(right.n(), m())); + Assert(dst.size() == m(), ExcDimensionMismatch(dst.size(), m())); + Assert(src.size() == n(), ExcDimensionMismatch(src.size(), n())); + Assert(right.size() == m(), ExcDimensionMismatch(right.size(), m())); unsigned int i,j; double s, res = 0.; @@ -345,8 +345,8 @@ double dFMatrix::residual (dVector& dst, const dVector& src, void dFMatrix::forward (dVector& dst, const dVector& src) const { Assert(n() == m(), ExcNotQuadratic()); - Assert(dst.n() == n(), ExcDimensionMismatch(dst.n(), n())); - Assert(src.n() == n(), ExcDimensionMismatch(src.n(), n())); + Assert(dst.size() == n(), ExcDimensionMismatch(dst.size(), n())); + Assert(src.size() == n(), ExcDimensionMismatch(src.size(), n())); unsigned int i,j; unsigned int nu = MIN(m(),n()); @@ -362,8 +362,8 @@ void dFMatrix::forward (dVector& dst, const dVector& src) const void dFMatrix::backward (dVector& dst, const dVector& src) const { Assert(n() == m(), ExcNotQuadratic()); - Assert(dst.n() == n(), ExcDimensionMismatch(dst.n(), n())); - Assert(src.n() == n(), ExcDimensionMismatch(src.n(), n())); + Assert(dst.size() == n(), ExcDimensionMismatch(dst.size(), n())); + Assert(src.size() == n(), ExcDimensionMismatch(src.size(), n())); unsigned int j; unsigned int nu = MIN(m(),n()); diff --git a/deal.II/lac/source/dsmatrix.cc b/deal.II/lac/source/dsmatrix.cc index 6ca5d49372..a0ac457eb9 100644 --- a/deal.II/lac/source/dsmatrix.cc +++ b/deal.II/lac/source/dsmatrix.cc @@ -386,8 +386,8 @@ void dSMatrix::vmult (dVector& dst, const dVector& src) const { Assert (cols != 0, ExcMatrixNotInitialized()); - Assert(m() == dst.n(), ExcDimensionsDontMatch(m(),dst.n())); - Assert(n() == src.n(), ExcDimensionsDontMatch(n(),src.n())); + Assert(m() == dst.size(), ExcDimensionsDontMatch(m(),dst.size())); + Assert(n() == src.size(), ExcDimensionsDontMatch(n(),src.size())); for (unsigned int i=0; imaxdim) { if (val) delete[] val; @@ -170,7 +170,7 @@ double dVector::mean_value () const for (unsigned int i=(dim/4)*4; i