From: bangerth Date: Sun, 5 Aug 2007 23:54:13 +0000 (+0000) Subject: Move a few files to vector.h and make them inline because we need them in libbase... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=947e66d1d2ff1b47b4775e52b031763afb37da9b;p=dealii-svn.git Move a few files to vector.h and make them inline because we need them in libbase since the latest changes to the DerivativeFunction class. This approach isn't pretty, but necessary for libraries to link on Mac OS X apparently. git-svn-id: https://svn.dealii.org/trunk@14902 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/vector.h b/deal.II/lac/include/lac/vector.h index 61872652d5..7251f05525 100644 --- a/deal.II/lac/include/lac/vector.h +++ b/deal.II/lac/include/lac/vector.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -951,7 +951,8 @@ Vector & Vector::operator *= (const Number factor) template inline -Vector & Vector::operator /= (const Number factor) +Vector & +Vector::operator /= (const Number factor) { Assert (deal_II_numbers::is_finite(factor), ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)")); @@ -963,6 +964,68 @@ Vector & Vector::operator /= (const Number factor) +template +inline +void +Vector::scale (const Number factor) +{ + Assert (deal_II_numbers::is_finite(factor), + ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)")); + + Assert (vec_size!=0, ExcEmptyObject()); + + iterator ptr = begin(); + const const_iterator eptr = end(); + while (ptr!=eptr) + *ptr++ *= factor; +} + + + +template +inline +void +Vector::add (const Number a, + const Vector& v) +{ + Assert (deal_II_numbers::is_finite(a), + ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)")); + + Assert (vec_size!=0, ExcEmptyObject()); + Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size)); + + iterator i_ptr = begin(), + i_end = end(); + const_iterator v_ptr = v.begin(); + while (i_ptr!=i_end) + *i_ptr++ += a * *v_ptr++; +} + + + +template +inline +void +Vector::sadd (const Number x, + const Number a, + const Vector& v) +{ + Assert (deal_II_numbers::is_finite(x), + ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)")); + Assert (deal_II_numbers::is_finite(a), + ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)")); + + Assert (vec_size!=0, ExcEmptyObject()); + Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size)); + iterator i_ptr = begin(), + i_end = end(); + const_iterator v_ptr = v.begin(); + for (; i_ptr!=i_end; ++i_ptr) + *i_ptr = x * *i_ptr + a * *v_ptr++; +} + + + template template diff --git a/deal.II/lac/include/lac/vector.templates.h b/deal.II/lac/include/lac/vector.templates.h index 09985c01a8..a39e2209f1 100644 --- a/deal.II/lac/include/lac/vector.templates.h +++ b/deal.II/lac/include/lac/vector.templates.h @@ -439,23 +439,6 @@ void Vector::add (const Vector& v) } -template -void Vector::add (const Number a, const Vector& v) -{ - Assert (deal_II_numbers::is_finite(a), - ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)")); - - Assert (vec_size!=0, ExcEmptyObject()); - Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size)); - - iterator i_ptr = begin(), - i_end = end(); - const_iterator v_ptr = v.begin(); - while (i_ptr!=i_end) - *i_ptr++ += a * *v_ptr++; -} - - template void Vector::add (const Number a, const Vector& v, const Number b, const Vector& w) @@ -493,24 +476,6 @@ void Vector::sadd (const Number x, const Vector& v) } -template -void Vector::sadd (const Number x, const Number a, - const Vector& v) -{ - Assert (deal_II_numbers::is_finite(x), - ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)")); - Assert (deal_II_numbers::is_finite(a), - ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)")); - - Assert (vec_size!=0, ExcEmptyObject()); - Assert (vec_size == v.vec_size, ExcDimensionMismatch(vec_size, v.vec_size)); - iterator i_ptr = begin(), - i_end = end(); - const_iterator v_ptr = v.begin(); - for (; i_ptr!=i_end; ++i_ptr) - *i_ptr = x * *i_ptr + a * *v_ptr++; -} - template void Vector::sadd (const Number x, const Number a, @@ -567,22 +532,6 @@ void Vector::sadd (const Number x, const Number a, -template -void Vector::scale (const Number factor) -{ - Assert (deal_II_numbers::is_finite(factor), - ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)")); - - Assert (vec_size!=0, ExcEmptyObject()); - - iterator ptr = begin(); - const const_iterator eptr = end(); - while (ptr!=eptr) - *ptr++ *= factor; -} - - - template template void Vector::scale (const Vector &s)