Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

src/expde/formulas/diffop.cc

Go to the documentation of this file.
00001 //    expde: expression templates for partial differential equations.
00002 //    Copyright (C) 2001  Christoph Pflaum
00003 //    This program is free software; you can redistribute it and/or modify
00004 //    it under the terms of the GNU General Public License as published by
00005 //    the Free Software Foundation; either version 2 of the License, or
00006 //    (at your option) any later version.
00007 //
00008 //    This program is distributed in the hope that it will be useful,
00009 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 //    GNU General Public License for more details.
00012 //
00013 //                 SEE  Notice1.doc made by 
00014 //                 LAWRENCE LIVERMORE NATIONAL LABORATORY
00015 //
00016 
00017 // ------------------------------------------------------------
00018 //
00019 // boundary.cc
00020 //
00021 // ------------------------------------------------------------
00022 
00023 // Include level 0:
00024 #ifdef COMP_GNUOLD
00025  #include <iostream.h>
00026  #include <fstream.h>
00027 #else
00028  #include <iostream>
00029  #include <fstream>
00030 #endif 
00031 
00032 // Include level 1:
00033 #include "../paramete.h"
00034 #include "../abbrevi.h"
00035 #include "../math_lib/math_lib.h"
00036 
00037 // Include level 4:
00038 #include "boundy.h"
00039 #include "diffop.h"
00040 
00041 
00042 Boundary_matrices::Boundary_matrices(int max_number_matrices,
00043                                      BoCeData* bocedata) {
00044   int i,j;
00045   Tetraeder_storage* tet;
00046   bool* needed;
00047 
00048   max_num_matrices = max_number_matrices;
00049   if(bocedata->Exists_bocellpoint())
00050     leng_col = bocedata->Give_number_points() + 1;
00051   else
00052     leng_col = bocedata->Give_number_points();
00053   leng_row = new int[leng_col];
00054   needed   = new bool[leng_col];
00055 
00056   // calc size of matrix and entires
00057   int max_leng;
00058   max_leng=0;
00059   for(i=0;i<leng_col;++i) {
00060     // a) size of row
00061     for(j=0;j<leng_col;++j) needed[j] = false;
00062 
00063     for(tet=bocedata->Give_tets();tet!=NULL;tet=tet->Next()) {
00064       if(tet->N0()==i || tet->N1()==i || tet->N2()==i || tet->N3()==i) {
00065         needed[tet->N0()]=true;
00066         needed[tet->N1()]=true;
00067         needed[tet->N2()]=true;
00068         needed[tet->N3()]=true;
00069       }
00070     }
00071     leng_row[i] = 0;
00072     for(j=0;j<leng_col;++j)
00073       if(needed[j])
00074         ++leng_row[i];
00075 
00076     if(max_leng<leng_row[i]) max_leng=leng_row[i];
00077   }
00078 
00079   // b) entries
00080   num_row = new int[max_leng*leng_col];
00081 
00082   int num;
00083   for(i=0;i<leng_col;++i) {
00084     for(j=0;j<leng_col;++j) needed[j] = false;
00085     
00086     for(tet=bocedata->Give_tets();tet!=NULL;tet=tet->Next()) {
00087       if(tet->N0()==i || tet->N1()==i || tet->N2()==i || tet->N3()==i) {
00088         needed[tet->N0()]=true;
00089         needed[tet->N1()]=true;
00090         needed[tet->N2()]=true;
00091         needed[tet->N3()]=true;
00092       }
00093     }
00094     num = 0;
00095     for(j=0;j<leng_col;++j)
00096       if(needed[j]) {
00097         ++num;
00098         num_row[i+leng_col*num] = j;
00099       }
00100   }
00101   
00102   // c) initialize matrix;
00103   matrix = new double[max_num_matrices*max_leng*leng_col];
00104 }

Generated on Fri Nov 2 01:25:58 2007 for IPPL by doxygen 1.3.5