From 3a4cec5e29574ff58d5719e7f68f46999ea36884 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 6 Mar 1998 16:06:39 +0000 Subject: [PATCH] Some exception updating. git-svn-id: https://svn.dealii.org/trunk@36 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/source/Makefile | 61 +++++++++++++++++++++ deal.II/lac/source/dfmatrix.cc | 97 ++++++++++++++++++++++++---------- 2 files changed, 131 insertions(+), 27 deletions(-) create mode 100644 deal.II/lac/source/Makefile diff --git a/deal.II/lac/source/Makefile b/deal.II/lac/source/Makefile new file mode 100644 index 0000000000..7b9c1ec54f --- /dev/null +++ b/deal.II/lac/source/Makefile @@ -0,0 +1,61 @@ +# $Id$ + +CXX = c++ +INCLUDE = -I../include -I../../base/include +CXXFLAGS.g= -DDEBUG -g -Wall -pedantic -Wconversion \ + -Winline -Woverloaded-virtual $(INCLUDE) +CXXFLAGS =-O3 -Wuninitialized -finline-functions -ffast-math \ + -funroll-loops -felide-constructors -fnonnull-objects $(INCLUDE) + +ifeq ($(shell uname),SunOS) +CXXFLAGS := -V2.7.2.3 $(CXXFLAGS) +CXXFLAGS.g:= -V2.7.2.3 $(CXXFLAGS.g) +endif + + +cc-files = $(wildcard *.cc) +o-files = $(cc-files:.cc=.o) +go-files = $(cc-files:.cc=.go) +h-files = $(wildcard ../include/*/*.h) + + +%.go : %.cc + @echo ============================ Compiling with debugging information: $< + @echo $(CXX) ... -c $< -o $@ + @$(CXX) $(CXXFLAGS.g) -c $< -o $@ +%.o : %.cc + @echo ============================ Compiling with optimization: $< + @echo $(CXX) ... -c $< -o $@ + @$(CXX) $(CXXFLAGS) -c $< -o $@ + + +lib: lib.g.a lib.a + +lib.a: ../lib/liblac.a($(o-files)) + +lib.g.a: ../lib/liblac.g.a($(go-files)) + +clean: + rm -f *.o *.go *~ Makefile.dep + + + +.PHONY: lib lib.a lib.g.a clean + + +#Rule to generate the dependency file. This file is +#automagically remade whenever needed, i.e. whenever +#one of the cc-/h-files changed. Make detects whether +#to remake this file upon inclusion at the bottom +#of this file. +# +#use perl to generate rules for the .go files as well +#as to make rules not for tria.o and the like, but +#rather for libbasic.a(tria.o) +Makefile.dep: $(cc-files) $(h-files) + @echo ============================ Remaking Makefile + perl ../Make_dep.pl ../lib/liblac $(INCLUDE) $(cc-files) \ + > Makefile.dep + + +include Makefile.dep diff --git a/deal.II/lac/source/dfmatrix.cc b/deal.II/lac/source/dfmatrix.cc index 6f583a99f0..1c480843b6 100644 --- a/deal.II/lac/source/dfmatrix.cc +++ b/deal.II/lac/source/dfmatrix.cc @@ -6,7 +6,29 @@ static const char* OBJFILE = "DEAL $RCSfile$ $Revision$"; #include #include #include -#include +#include + + + +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); + + + + dFMatrix::dFMatrix (const dFMatrix &m) { @@ -171,6 +193,7 @@ void dFMatrix::gsmult(dVector& dst, const dVector& src,const iVector& gl) const Assert(dst.n() == n(), ExcDimensionMismatch(dst.n(), n())); Assert(src.n() == n(), ExcDimensionMismatch(src.n(), n())); Assert(gl.n() == n(), ExcDimensionMismatch(gl.n(), n())); + double s; if ((n()==3) && (m()==3)) { @@ -314,6 +337,7 @@ double dFMatrix::residual(dVector& dst, const dVector& src, Assert(dst.n() == m(), ExcDimensionMismatch(dst.n(), m())); Assert(src.n() == n(), ExcDimensionMismatch(src.n(), n())); Assert(right.n() == m(), ExcDimensionMismatch(right.n(), m())); + int i,j; double s, res = 0.; for (i=0;i= src.n() + j, ExcInvalidDestination(n(), src.n(), j)); + Assert (m() >= src.m() + i, ExcInvalidDestination(m(), src.m(), i)); for (int ii=0; ii3), IntError::Range(dim_range)); + Assert (dim_range == dim_image, + ExcDimensionMismatch(dim_range, dim_image)); + Assert ((dim_range>=1) && (dim_range<=3), ExcNotImplemented(dim_range)); switch (dim_range) { @@ -887,17 +922,20 @@ double dFMatrix::determinant () const { void dFMatrix::clear () { - for (unsigned int i=0; i3), IntError::Range(dim_range)); -// THROW2 ((dim_range != M.dim_range) || (dim_image != M.dim_image), -// ExcXXX()); +void dFMatrix::invert (const dFMatrix &M) { + Assert (dim_range == dim_image, ExcNotQuadratic()); + Assert ((dim_range>=1) && (dim_range<=3), ExcNotImplemented(dim_range)); + Assert (dim_range == M.dim_range, + ExcDimensionMismatch(dim_range,M.dim_range)); + Assert (dim_image == M.dim_image, + ExcDimensionMismatch(dim_image,M.dim_image)); + switch (dim_range) { case 1: @@ -906,13 +944,17 @@ void dFMatrix.invert (const dFMatrix &M) { case 2: // this is Maple output, // thus a bit unstructured + { const double t4 = 1.0/(M.el(0,0)*M.el(1,1)-M.el(0,1)*M.el(1,0)); el(0,0) = M.el(1,1)*t4; el(0,1) = -M.el(0,1)*t4; el(1,0) = -M.el(1,0)*t4; el(1,1) = M.el(0,0)*t4; return; + }; + case 3: + { const double t4 = M.el(0,0)*M.el(1,1), t6 = M.el(0,0)*M.el(1,2), t8 = M.el(0,1)*M.el(1,0), @@ -931,6 +973,7 @@ void dFMatrix.invert (const dFMatrix &M) { el(2,1) = -(M.el(0,0)*M.el(2,1)-t01)*t07; el(2,2) = (t4-t8)*t07; return; + }; }; -); +}; -- 2.39.5