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<double>::iterator next_dof_value=dof_values.begin();
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<double>::iterator next_dof_value=dof_values.begin();
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
// -1, this line will be condensed away
vector<int> new_line;
- new_line.reserve (uncondensed.n());
+ new_line.reserve (uncondensed.size());
vector<ConstraintLine>::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
// only evaluated so often as there are
// entries in new_line[*] which tells us
// which constraints exist
- for (unsigned int row=0; row<uncondensed.n(); ++row)
+ for (unsigned int row=0; row<uncondensed.size(); ++row)
if (new_line[row] != -1)
// line not constrained
// copy entry
return;
vector<ConstraintLine>::const_iterator next_constraint = lines.begin();
- for (unsigned int row=0; row<vec.n(); ++row)
+ for (unsigned int row=0; row<vec.size(); ++row)
if (row == next_constraint->line)
// line must be distributed
{
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
// -1, this line was condensed away
vector<int> old_line;
- old_line.reserve (uncondensed.n());
+ old_line.reserve (uncondensed.size());
vector<ConstraintLine>::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
// only evaluated so often as there are
// entries in new_line[*] which tells us
// which constraints exist
- for (unsigned int line=0; line<uncondensed.n(); ++line)
+ for (unsigned int line=0; line<uncondensed.size(); ++line)
if (old_line[line] != -1)
// line was not condensed away
uncondensed(line) = condensed(old_line[line]);
template <int dim>
void DoFHandler<dim>::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());
template <int dim>
void Triangulation<dim>::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<n_cells; ++cell, ++index)
if (criteria(index) > threshold)
const double fraction) {
dVector tmp(criteria);
nth_element (tmp.begin(),
- tmp.begin()+static_cast<int>(fraction*tmp.n()),
+ tmp.begin()+static_cast<int>(fraction*tmp.size()),
tmp.end(),
greater<double>());
refine (criteria, *(tmp.begin() +
- static_cast<int>(fraction*tmp.n())));
+ static_cast<int>(fraction*tmp.size())));
};
Assert (matrix.n() == dof_handler->n_dofs(), ExcInvalidData());
Assert (((AssemblerData<dim>*)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());
};
double tolerance = 1.e-16;
Control control1(max_iter,tolerance);
- PrimitiveVectorMemory<dVector> memory(right_hand_side.n());
+ PrimitiveVectorMemory<dVector> memory(right_hand_side.size());
CG<dSMatrix,dVector> cg(control1,memory);
// solve
* Inquire Dimension. returns Dimension ,
* INLINE
*/
- unsigned int n () const;
+ unsigned int size () const;
/**
* Make the #dVector# class a bit like the
-inline unsigned int dVector::n () const
+inline unsigned int dVector::size () const
{
return dim;
}
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))
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;
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;
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.;
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());
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());
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; i<m(); ++i)
{
dSMatrix::Tvmult (dVector& dst, const dVector& src) const
{
Assert (cols != 0, ExcMatrixNotInitialized());
- Assert(n() == dst.n(), ExcDimensionsDontMatch(n(),dst.n()));
- Assert(m() == src.n(), ExcDimensionsDontMatch(m(),src.n()));
+ Assert(n() == dst.size(), ExcDimensionsDontMatch(n(),dst.size()));
+ Assert(m() == src.size(), ExcDimensionsDontMatch(m(),src.size()));
unsigned int i;
dSMatrix::matrix_norm (const dVector& v) const
{
Assert (cols != 0, ExcMatrixNotInitialized());
- Assert(m() == v.n(), ExcDimensionsDontMatch(m(),v.n()));
- Assert(n() == v.n(), ExcDimensionsDontMatch(n(),v.n()));
+ Assert(m() == v.size(), ExcDimensionsDontMatch(m(),v.size()));
+ Assert(n() == v.size(), ExcDimensionsDontMatch(n(),v.size()));
double sum = 0.;
for (unsigned int i=0;i<m();i++)
dSMatrix::residual (dVector& dst, const dVector& u, const dVector& b)
{
Assert (cols != 0, ExcMatrixNotInitialized());
- Assert(m() == dst.n(), ExcDimensionsDontMatch(m(),dst.n()));
- Assert(m() == b.n(), ExcDimensionsDontMatch(m(),b.n()));
- Assert(n() == u.n(), ExcDimensionsDontMatch(n(),u.n()));
+ Assert(m() == dst.size(), ExcDimensionsDontMatch(m(),dst.size()));
+ Assert(m() == b.size(), ExcDimensionsDontMatch(m(),b.size()));
+ Assert(n() == u.size(), ExcDimensionsDontMatch(n(),u.size()));
double s,norm=0.;
{
Assert (cols != 0, ExcMatrixNotInitialized());
- const unsigned int n = src.n();
+ const unsigned int n = src.size();
for (unsigned int i=0;i<n;++i)
{
Assert (cols != 0, ExcMatrixNotInitialized());
int p;
- unsigned int n = src.n();
+ const unsigned int n = src.size();
unsigned int j;
for (unsigned i=0; i<n; i++)
{
Assert (cols != 0, ExcMatrixNotInitialized());
Assert(n() == m(), ExcDimensionsDontMatch(n(),m()));
- Assert(m() == dst.n(), ExcDimensionsDontMatch(m(),dst.n()));
+ Assert(m() == dst.size(), ExcDimensionsDontMatch(m(),dst.size()));
for (unsigned int i=0;i<m();i++)
{
Assert (cols != 0, ExcMatrixNotInitialized());
int p;
- unsigned int n = dst.n();
+ const unsigned int n = dst.size();
unsigned int j;
double s;
dVector::dVector (const dVector& v) :
VectorBase(v),
- dim(v.n()),
- maxdim(v.n()),
+ dim(v.size()),
+ maxdim(v.size()),
val(0)
{
if (dim)
void dVector::reinit (const dVector& v, const bool fast)
{
- const unsigned int n = v.n();
+ const unsigned int n = v.size();
if (n>maxdim)
{
if (val) delete[] val;
for (unsigned int i=(dim/4)*4; i<dim; ++i)
sum0 += val[i];
- return (sum0+sum1+sum2+sum3)/n();
+ return (sum0+sum1+sum2+sum3)/size();
};
void dVector::print (FILE* f, const char* format) const
{
if (!format) format = " %5.2f";
- for (unsigned int j=0;j<n();j++)
+ for (unsigned int j=0;j<size();j++)
fprintf(f, format, val[j]);
fputc('\n',f);
}
void dVector::print (const char* format) const
{
if (!format) format = " %5.2f";
- for (unsigned int j=0;j<n();j++)
+ for (unsigned int j=0;j<size();j++)
printf (format, val[j]);
printf ("\n");
}
void dVector::print (ostream &out) const {
- for (unsigned int i=0; i<n(); ++i)
+ for (unsigned int i=0; i<size(); ++i)
out << val[i] << endl;
};