#include <lac/ivector.h>
#endif
+#include <base/exceptions.h>
+
+
+
/**
* Double precision full Matrix.
* Memory for Components is supplied explicitly <p>
*/
double operator() (int i, int j) const
{
- //THROW2((i<0) || (i>=dim_image), IntError(IntError::Range,i));
- //THROW2((j<0) || (j>=dim_range), IntError(IntError::Range,i));
+ Assert ((i>=0) && (i<dim_image), ExcInvalidIndex (i, dim_image));
+ Assert ((j>=0) && (j<dim_range), ExcInvalidIndex (i, dim_range));
return el(i,j);
}
*/
double& operator() (int i, int j)
{
- //THROW2((i<0) || (i>=dim_image), IntError(IntError::Range,i));
- //THROW2((j<0) || (j>=dim_range), IntError(IntError::Range,i));
+ Assert ((i>=0) && (i<dim_image), ExcInvalidIndex (i, dim_image));
+ Assert ((j>=0) && (j<dim_range), ExcInvalidIndex (i, dim_range));
return el(i,j);
}
*/
void print(FILE* fp, const char* format = 0) const;
//@}
+
+ /**
+ * Exception
+ */
+ DeclException2 (ExcInvalidIndex,
+ int, int,
+ << "The given index " << arg1
+ << " should be less than " << arg2 << ".");
+ /**
+ * Exception
+ */
+ DeclException2 (ExcDimensionMismatch,
+ int, int,
+ << "The two dimensions " << arg1 << " and " << arg2
+ << "do not match here.");
+ /**
+ * Exception
+ */
+ DeclException0 (ExcNotQuadratic);
+ /**
+ * Exception
+ */
+ DeclException0 (ExcInternalError);
+ /**
+ * Exception
+ */
+ DeclException3 (ExcInvalidDestination,
+ int, int, int,
+ << "Target region not in matrix: size in this direction="
+ << arg1 << ", size of new matrix=" << arg2
+ << ", offset=" << arg3);
+ /**
+ * Exception
+ */
+ DeclException1 (ExcNotImplemented,
+ int,
+ << "This function is not implemented for the given"
+ << " matrix dimension " << arg1);
};
#endif
#include <lac/ivector.h>
#endif
+#include <base/exceptions.h>
+
+
class ostream;
template <int dim> class DoFHandler;
friend class ConstraintMatrix;
friend class DoFHandler<1>;
friend class DoFHandler<2>;
+
+ /**
+ * Exception
+ */
+ DeclException1 (ExcInvalidNumber,
+ int,
+ << "The provided number is invalid here: " << arg1);
+ /**
+ * Exception
+ */
+ DeclException2 (ExcInvalidIndex,
+ int, int,
+ << "The given index " << arg1
+ << " should be less than " << arg2 << ".");
+
};
+
+
+
+
+
/*
CLASS
dSMatrix
#include <lac/vectorbase.h>
#endif
+#include <base/exceptions.h>
+
+
/**
* Double precision Vector.
*/
void print(const char* format = 0) const;
//@}
+
+ /**
+ * Exception
+ */
+ DeclException2 (ExcInvalidIndex,
+ int, int,
+ << "The given index " << arg1
+ << " should be less than " << arg2 << ".");
+ /**
+ * Exception
+ */
+ DeclException1 (ExcInvalidNumber,
+ int,
+ << "The provided number is invalid here: " << arg1);
+ /**
+ * Exception
+ */
+ DeclException0 (ExcOutOfMemory);
};
inline double dVector::operator() (int i) const
{
- //THROW2( (i<0) || (i>=dim), IntError(IntError::Range,i));
+ Assert ((i>=0) || (i<dim), ExcInvalidIndex(i,dim));
return val[i];
}
inline double& dVector::operator() (int i)
{
- //THROW2( (i<0) || (i>=dim), IntError(IntError::Range,i));
+ Assert ((i>=0) || (i<dim), ExcInvalidIndex(i,dim));
return val[i];
}
#include <base/types.h>
#endif
+#include <base/exceptions.h>
/**
*/
void equ(int a, const iVector& V);
//@}
+
+ /**
+ * Exception
+ */
+ DeclException2 (ExcInvalidIndex,
+ int, int,
+ << "The given index " << arg1
+ << " should be less than " << arg2 << ".");
+ /**
+ * Exception
+ */
+ DeclException1 (ExcInvalidNumber,
+ int,
+ << "The provided number is invalid here: " << arg1);
+ /**
+ * Exception
+ */
+ DeclException0 (ExcOutOfMemory);
};
inline int iVector::operator() (int i) const
{
-//THROW2( (i<0) || (i>=dim), IntError(IntError::Range,i));
+ Assert ((i>=0) || (i<dim), ExcInvalidIndex(i,dim));
return val[i];
}
inline int& iVector::operator() (int i)
{
-// THROW2( (i<0) || (i>=dim), IntError(IntError::Range,i));
+ Assert ((i>=0) || (i<dim), ExcInvalidIndex(i,dim));
return val[i];
}
#endif
// $Id$
-static const char* OBJFILE = "DEAL $RCSfile$ $Revision$";
-
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <lac/dfmatrix.h>
-#include <base/exceptions.h>
-
-
-
-DeclException2 (ExcDimensionMismatch,
- int, int,
- << "The two dimensions " << arg1 << " and " << arg2
- << "do not match here.");
-DeclException0 (ExcNotQuadratic);
-DeclException0 (ExcInternalError);
-DeclException3 (ExcInvalidDestination,
- int, int, int,
- << "Target region not in matrix: size in this direction="
- << arg1 << ", size of new matrix=" << arg2
- << ", offset=" << arg3);
-DeclException1 (ExcNotImplemented,
- int,
- << "This function is not implemented for the given"
- << " matrix dimension " << arg1);
// DEAL is Copyright(1995) by
// Roland Becker, Guido Kanschat, Franz-Theo Suttmeier
-static const char* OBJFILE = "DEAL $RCSfile$ $Revision$";
-
#include <lac/dsmatrix.h>
#include <ostream.h>
void
dSMatrixStruct::reinit(int m, int n, int max_per_row)
{
-// THROW1(m<=0, IntError(IntError::IllegalDimension, m));
-// THROW1(n<=0, IntError(IntError::IllegalDimension, n));
-// THROW1(max_per_row<=0, IntError(IntError::IllegalDimension, max_per_row));
+ Assert (m>0, ExcInvalidNumber(m));
+ Assert (n>0, ExcInvalidNumber(n));
+ Assert (max_per_row>0, ExcInvalidNumber(max_per_row));
rows = m;
cols = n;
vec_len = m * max_per_row;
void
dSMatrixStruct::add (int i, int j)
{
- //THROW1((i<0) || (i>=rows), IntError(IntError::Range,i));
- //THROW1((j<0) || (j>=cols), IntError(IntError::Range,j));
+ Assert ((i>=0) && (i<rows), ExcInvalidIndex(i,rows));
+ Assert ((j>=0) && (j<cols), ExcInvalidIndex(j,cols));
+
int k;
for (k=rowstart[i]; k<rowstart[i+1]; k++)
{
// DEAL is Copyright(1995) by
// Roland Becker, Guido Kanschat, Franz-Theo Suttmeier
-static const char* OBJFILE = "DEAL $RCSfile$ $Revision$";
-
#include <lac/dvector.h>
#include <math.h>
dVector::dVector(int n) : val(0)
{
+ Assert (n>0, ExcInvalidNumber(n));
+
dim = n;
maxdim = n;
- //THROW1(n<0, IntError(IntError::IllegalDimension, n, "dVector"));
-
if (n)
{
val = new double[maxdim];
- //THROWUNCOND(!val, Error(Error::NoMem,"dVector::dVector"));
+ Assert (val != 0, ExcOutOfMemory());
(*this) = 0.;
}
}
if (dim)
{
val = new double[maxdim];
- //THROWUNCOND(!val, Error(Error::NoMem,"dVector::dVector"));
+ Assert (val != 0, ExcOutOfMemory());
for (int i=0;i<dim;i++) val[i] = v.val[i];
}
}
void dVector::reinit(int n, int fast)
{
- //THROW1(n<=0, IntError(IntError::IllegalDimension, n));
+ Assert (n>0, ExcInvalidNumber(n));
if (n>maxdim)
{
if (val) delete[] val;
val = new double[n];
- //THROWUNCOND(!val, Error(Error::NoMem,"dVector::reinit"));
+ Assert (val != 0, ExcOutOfMemory());
maxdim = n;
}
dim = n;
{
if (val) delete[] val;
val = new double[n];
- //THROWUNCOND(!val, Error(Error::NoMem,"dVector::reinit"));
+ Assert (val != 0, ExcOutOfMemory());
maxdim = n;
}
dim = n;
void dVector::cadd(int i, const VectorBase& V, double s, int j)
{
const dVector& v = (const dVector&) V;
- //THROW1((i<0) || (i>dim), IntError(IntError::Range,i,"cadd"));
- //THROW1((j<0) || (j>v.dim), IntError(IntError::Range,j,"cadd"));
+
+ Assert ((i>=0) || (i<dim), ExcInvalidIndex(i,dim));
+ Assert ((j>=0) || (j<v.dim), ExcInvalidIndex(j,v.dim));
val[i] += s*v.val[j];
}
void dVector::cadd(int i, const VectorBase& V, double s, int j, double t, int k)
{
const dVector& v = (const dVector&) V;
- //THROW1((i<0) || (i>dim), IntError(IntError::Range,i,"cadd"));
- //THROW1((j<0) || (j>v.dim), IntError(IntError::Range,j,"cadd"));
- //THROW1((k<0) || (k>v.dim), IntError(IntError::Range,k,"cadd"));
+
+ Assert ((i>=0) || (i<dim), ExcInvalidIndex(i,dim));
+ Assert ((j>=0) || (j<v.dim), ExcInvalidIndex(j,v.dim));
+ Assert ((k>=0) || (k<v.dim), ExcInvalidIndex(k,v.dim));
val[i] += s*v.val[j] + t*v.val[k];
}
double t, int k, double q, int l, double r, int m)
{
const dVector& v = (const dVector&) V;
- //THROW1((i<0) || (i>dim), IntError(IntError::Range,i,"cadd"));
- //THROW1((j<0) || (j>v.dim), IntError(IntError::Range,j,"cadd"));
- //THROW1((k<0) || (k>v.dim), IntError(IntError::Range,k,"cadd"));
- //THROW1((l<0) || (l>v.dim), IntError(IntError::Range,l,"cadd"));
- //THROW1((m<0) || (m>v.dim), IntError(IntError::Range,m,"cadd"));
+
+ Assert ((i>=0) || (i<dim), ExcInvalidIndex(i,dim));
+ Assert ((j>=0) || (j<v.dim), ExcInvalidIndex(j,v.dim));
+ Assert ((k>=0) || (k<v.dim), ExcInvalidIndex(k,v.dim));
+ Assert ((l>=0) || (l<v.dim), ExcInvalidIndex(l,v.dim));
+ Assert ((m>=0) || (m<v.dim), ExcInvalidIndex(m,v.dim));
val[i] += s*v.val[j] + t*v.val[k] + q*v.val[l] + r*v.val[m];
}
void dVector::czero(int i)
{
- //THROW1((i<0) || (i>dim), IntError(IntError::Range,i));
- val[i] = 0.;
+ Assert ((i>=0) && (i<dim), ExcInvalidIndex(i,dim));
+ val[i] = 0.;
}
void dVector::cequ(int i, const VectorBase& V, double s, int j)
{
const dVector& v = (const dVector&) V;
- //THROW1((i<0) || (i>dim), IntError(IntError::Range,i,"cequ"));
- //THROW1((j<0) || (j>v.dim), IntError(IntError::Range,j,"cequ"));
+
+ Assert ((i>=0) && (i<dim), ExcInvalidIndex(i,dim));
+ Assert ((j>=0) && (j<v.dim), ExcInvalidIndex(j,v.dim));
val[i] = s*v.val[j];
}
void dVector::cequ(int i, const VectorBase& V, double s, int j, double t, int k)
{
const dVector& v = (const dVector&) V;
- //THROW1((i<0) || (i>dim), IntError(IntError::Range,i,"cequ"));
- //THROW1((j<0) || (j>v.dim), IntError(IntError::Range,j,"cequ"));
- //THROW1((k<0) || (k>v.dim), IntError(IntError::Range,k,"cequ"));
+
+ Assert ((i>=0) || (i<dim), ExcInvalidIndex(i,dim));
+ Assert ((j>=0) || (j<v.dim), ExcInvalidIndex(j,v.dim));
+ Assert ((k>=0) || (k<v.dim), ExcInvalidIndex(k,v.dim));
val[i] = s*v.val[j] + t*v.val[k];
}
double t, int k, double q, int l, double r, int m)
{
const dVector& v = (const dVector&) V;
- //THROW1((i<0) || (i>dim), IntError(IntError::Range,i,"cequ"));
- //THROW1((j<0) || (j>v.dim), IntError(IntError::Range,j,"cequ"));
- //THROW1((k<0) || (k>v.dim), IntError(IntError::Range,k,"cequ"));
- //THROW1((l<0) || (l>v.dim), IntError(IntError::Range,l,"cequ"));
- //THROW1((m<0) || (m>v.dim), IntError(IntError::Range,m,"cequ"));
+
+ Assert ((i>=0) || (i<dim), ExcInvalidIndex(i,dim));
+ Assert ((j>=0) || (j<v.dim), ExcInvalidIndex(j,v.dim));
+ Assert ((k>=0) || (k<v.dim), ExcInvalidIndex(k,v.dim));
+ Assert ((l>=0) || (l<v.dim), ExcInvalidIndex(l,v.dim));
+ Assert ((m>=0) || (m<v.dim), ExcInvalidIndex(m,v.dim));
val[i] = s*v.val[j] + t*v.val[k] + q*v.val[l] + r*v.val[m];
}
// DEAL is Copyright(1995) by
// Roland Becker, Guido Kanschat, Franz-Theo Suttmeier
-static const char* OBJFILE = "DEAL $RCSfile$ $Revision$";
-
#include <lac/ivector.h>
+
+
iVector::iVector()
{
dim=maxdim=1;
val = new int[1];
- //THROWUNCOND(!val, Error(Error::NoMem,"iVector::iVector"));
+ Assert (val != 0, ExcOutOfMemory());
val[0] = 0;
}
iVector::iVector(int n)
{
+ Assert (n>0, ExcInvalidNumber(n));
+
dim = n;
maxdim = n;
- //THROW1(n<=0, IntError(IntError::IllegalDimension, n, "iVector::iVector"));
-
val = new int[maxdim];
- //THROWUNCOND(!val, Error(Error::NoMem,"iVector::iVector"));
+ Assert (val != 0, ExcOutOfMemory());
(*this) = 0;
}
void iVector::reinit(int n, int fast)
{
- //THROW1(n<=0, IntError(IntError::IllegalDimension, n, "iVector::reinit"));
+ Assert (n>0, ExcInvalidNumber(n));
if (n>maxdim)
{
delete[] val;
val = new int[n];
- //THROWUNCOND(!val, Error(Error::NoMem,"iVector::reinit"));
+ Assert (val != 0, ExcOutOfMemory());
maxdim = n;
}
dim = n;
{
delete[] val;
val = new int[n];
- //THROWUNCOND(!val, Error(Error::NoMem,"iVector::reinit"));
+ Assert (val != 0, ExcOutOfMemory());
maxdim = n;
}
dim = n;