Department of Scientific Computing   
Institute for Numerical Simulation   
University of Bonn   
Documentation
Download
Programming References
Bug Reports / Suggestions
FAQ
Authors
Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

LevelAdaptiveData.hpp

00001 //
00002 // Implementations for SubSpaces
00003 //
00004 
00005 #ifndef _SUBSPACES_
00006 # define _SUBSPACES_
00007 
00008 #include <assert.h>
00009 #include "LevelAdaptive.hpp"
00010 #include "Math.hpp"
00011 #include "NonAdaptive.hpp"
00012 
00013 //
00014 // General
00015 //
00016 template<int DIM>
00017 LevelAdaptiveData<DIM>::LevelAdaptiveData() {
00018  a=NULL ;
00019  G=NULL ;
00020  Ext.InitXAE() ;
00021 }
00022 
00023 
00024 template<int DIM>
00025 LevelAdaptiveData<DIM>::LevelAdaptiveData(LevelAdaptiveGrid<DIM> *AG) {
00026  a=NULL  ;
00027  Init (AG) ;
00028  Ext.InitXAE() ;
00029 }
00030 
00031 
00032 template<int DIM>
00033 void LevelAdaptiveData<DIM>::Init(LevelAdaptiveGrid<DIM> *AG) {
00034  G=AG  ;
00035  G->Attach(this) ;
00036 
00037  Ext.WC=G->W ;
00038  a=new Matrix< Matrix<double,DIM> *, DIM> ;
00039   
00040  int b[DIM]={0}  ;
00041  a->Init(b,G->L) ;
00042  
00043  Matrix< Matrix<double,DIM> *, DIM>::iterator it(a) ;
00044  for (it=(*a).begin(); it<=(*a).end(); ++it) (*a)[it]=NULL ;
00045 
00046  Allocate() ;
00047 }
00048 
00049 
00050 template<int DIM>
00051 void LevelAdaptiveData<DIM>::Clear() {
00052  if (a!=NULL) { 
00053    Matrix< Matrix<double,DIM> *, DIM>::iterator it(a) ;
00054    for (it=(*a).begin(); it<=(*a).end(); ++it) { delete (*a)[it] ; (*a)[it]=NULL ; }
00055    delete a; a=NULL  ;
00056  }
00057 
00058  G =NULL ;
00059 }
00060 
00061 
00062 template<int DIM>
00063 LevelAdaptiveData<DIM>::~LevelAdaptiveData() {
00064  Clear() ;
00065 }
00066 
00067 template<int DIM>
00068 size_t LevelAdaptiveData<DIM>::Size() {
00069  return G->Size() ;
00070 }
00071 
00072 
00073 template<int DIM>
00074 void LevelAdaptiveData<DIM>::Allocate() {
00075  int i ; 
00076  Matrix< Matrix<double,DIM> *, DIM>::iterator it(a) ;
00077  for (it=(*a).begin(); it<=(*a).end(); ++it) 
00078    if ( (*(G->a))[it.i] &&  ((*a)[it]==NULL) ) {
00079      int b[DIM],e[DIM] ;
00080      for (i=0; i<DIM; i++) { b[i]=0 ; e[i] = (it.i[i] == G->Level0[i]) ? 1<< G->Level0[i] : (1<<(it.i[i]-1)) -1 ; }
00081      (*a)[it]=new Matrix<double,DIM>(b,e) ;
00082     }
00083 }
00084 
00085 
00086 //
00087 //
00088 template<int DIM>
00089 void LevelAdaptiveData<DIM>::Compatible(LevelAdaptiveData<DIM> *X) {
00090   assert(Ext.IsSame(&X->Ext)) ;
00091 }
00092 
00093 template<int DIM>
00094 void LevelAdaptiveData<DIM>::Compatible(LevelAdaptiveData<DIM> *S0, LevelAdaptiveData<DIM> *S1) {
00095  Compatible(S0) ;
00096  Compatible(S1) ;
00097 }
00098 
00099 template<int DIM>
00100 void LevelAdaptiveData<DIM>::Compatible(LevelAdaptiveData<DIM> *S0, LevelAdaptiveData<DIM> *S1, LevelAdaptiveData<DIM> *S2) {
00101  Compatible(S0) ;
00102  Compatible(S1) ;
00103  Compatible(S2) ;
00104 }
00105 
00106 template<int DIM>
00107 void LevelAdaptiveData<DIM>::Compatible(LevelAdaptiveData<DIM> *S0, LevelAdaptiveData<DIM> *S1, LevelAdaptiveData<DIM> *S2, LevelAdaptiveData<DIM> *S3) {
00108  Compatible(S0) ;
00109  Compatible(S1) ;
00110  Compatible(S2) ;
00111  Compatible(S3) ;
00112 }
00113 
00114 template<int DIM>
00115 void LevelAdaptiveData<DIM>::CopyExtensions(LevelAdaptiveData<DIM> *X) {
00116   Ext.CopyFlags(&X->Ext) ;
00117 }
00118 
00119 //
00120 //
00121 template<int DIM>
00122 void LevelAdaptiveData<DIM>::SetBoundaryConditions(int B[DIM][2]) {
00123  Ext.SetBoundaryConditions(B) ;
00124 }
00125 
00126 template<int DIM>
00127 void LevelAdaptiveData<DIM>::SetBoundaryConditions(LevelAdaptiveData<DIM> *S) {
00128  Ext.SetBoundaryConditions(&S->Ext) ;
00129 }
00130 
00131 template<int DIM>
00132 void LevelAdaptiveData<DIM>::CheckBC(int BC0[DIM][2] , int BC1[DIM][2]) {
00133  int i ;
00134  for (i=0; i<DIM; i++) { assert(BC0[i][0]==BC1[i][0]) ; assert(BC0[i][1]==BC1[i][1]) ;}
00135 }
00136 
00137 //
00138 // Copy
00139 //
00140 template<int DIM>
00141 void LevelAdaptiveData<DIM>::Copy(LevelAdaptiveData<DIM> *S) {
00142  assert (A==S->A) ;
00143  
00144  int i ;
00145  for (i=0; i<DIM; i++) { BC[i][0]=S->BC[i][0] ; BC[i][1]=S->BC[i][1] ;}  
00146  
00147  Matrix<Matrix<double,DIM> * , DIM>::iterator it(a) ;
00148  for (it=(*a).begin(); it<=(*a).end(); ++it) 
00149     if ((*(G->a))[it.i]) (*a)[it]->Copy( (*S->a)[it] ) ;
00150  
00151  Ext.CopyFlags(&S->Ext) ;
00152  Ext.CopyData (&S->Ext) ;
00153 }
00154 
00155 //
00156 // linear algebra
00157 //
00158 template<int DIM>
00159 void LevelAdaptiveData<DIM>::PPlus(const double c0,LevelAdaptiveData<DIM> *S0) {
00160  Compatible(S0) ;
00161 
00162  Matrix<Matrix<double,DIM> * , DIM>::iterator it(a) ;
00163  for (it=(*a).begin(); it<=(*a).end(); ++it) 
00164     if ((*(G->a))[it.i]) (*a)[it]->PPlus(c0,(*S0->a)[it]) ;
00165 
00166  Ext.PPlus(c0,&S0->Ext) ;
00167 }
00168 
00169 template<int DIM>
00170 void LevelAdaptiveData<DIM>::Add(const double c0,LevelAdaptiveData<DIM> *S0 , const double c1,LevelAdaptiveData<DIM> *S1) {
00171  S0->Compatible(S1) ;
00172  CopyExtensions(S0) ;
00173 
00174  Matrix<Matrix<double,DIM> * , DIM>::iterator it(a) ;
00175  for (it=(*a).begin(); it<=(*a).end(); ++it) if ((*(G->a))[it.i]) (*a)[it]->Add(c0,(*(S0->a))[it] , c1,(*(S1->a))[it]) ;
00176 
00177  Ext.Add(c0,&S0->Ext , c1,&S1->Ext) ;
00178 }
00179 
00180 
00181 template<int DIM>
00182 void LevelAdaptiveData<DIM>::Add(const double c0,LevelAdaptiveData<DIM> *S0 , const double c1,LevelAdaptiveData<DIM> *S1 , const double c2,LevelAdaptiveData<DIM> *S2) {
00183  S0->Compatible(S1,S2) ;
00184  CopyExtensions(S0) ;
00185 
00186  Matrix<Matrix<double,DIM> * , DIM>::iterator it(a) ;
00187  for (it=(*a).begin(); it<=(*a).end(); ++it)
00188    if ((*(G->a))[it.i]) (*a)[it]->Add(c0,(*(S0->a))[it] , c1,(*(S1->a))[it]  , c2,(*(S2->a))[it]) ;
00189  
00190  Ext.Add(c0,&S0->Ext , c1,&S1->Ext , c2,&S2->Ext) ;
00191 }
00192 
00193 template<int DIM>
00194 void LevelAdaptiveData<DIM>::Add(const double c0,LevelAdaptiveData<DIM> *S0 , const double c1,LevelAdaptiveData<DIM> *S1 , const double c2,LevelAdaptiveData<DIM> *S2 ,
00195                          const double c3,LevelAdaptiveData<DIM> *S3) {
00196  S0->Compatible(S1,S2,S3) ;
00197 
00198  Matrix<Matrix<double,DIM> * , DIM>::iterator it(a) ;
00199  for (it=(*a).begin(); it<=(*a).end(); ++it)
00200    if ((*(G->a))[it.i]) (*a)[it]->Add(c0,(*(S0->a))[it] , c1,(*(S1->a))[it]  , c2,(*(S2->a))[it] , c3,(*(S3->a))[it]) ;
00201 
00202  Ext.Add(c0,&S0->Ext , c1,&S1->Ext , c2,&S2->Ext , c3,&S3->Ext) ;
00203 }
00204 
00205 
00206 template<int DIM>
00207 void LevelAdaptiveData<DIM>::Sub(LevelAdaptiveData<DIM> *S0 , LevelAdaptiveData<DIM> *S1) {
00208  S0->Compatible(S1) ;
00209  CopyExtensions(S0) ;
00210 
00211  Matrix<Matrix<double,DIM> * , DIM>::iterator it(a) ;
00212  for (it=(*a).begin(); it<=(*a).end(); ++it) if ((*(G->a))[it.i]) (*a)[it]->Sub((*(S0->a))[it] , (*(S1->a))[it]) ;
00213 
00214  Ext.Sub(c0,&S0->Ext , c1,&S1->Ext) ;
00215 }
00216 
00217 
00218 template<int DIM>
00219 void LevelAdaptiveData<DIM>::Mul(double f) {
00220 
00221  Matrix<Matrix<double,DIM> * , DIM>::iterator l(a) ;
00222  for (l=(*a).begin(); l<=(*a).end(); ++l) if ((*(G->a))[l.i]) (*a)[l]->Mul(f) ;
00223 
00224  Ext.Mul(f);
00225 }
00226 
00227 
00228 template<int DIM>
00229 double LevelAdaptiveData<DIM>::InnerProd(LevelAdaptiveData<DIM> *S) {
00230  double s=0 ;
00231  Compatible(S) ;
00232 
00233  Matrix<Matrix<double,DIM> * , DIM>::iterator it(a) ;
00234  for (it=(*a).begin(); it<=(*a).end(); ++it) if ((*(G->a))[it.i])  s+= (*a)[it]->InnerProd((*(S->a))[it]) ;
00235 
00236  return s + Ext.InnerProd(&S->Ext) ;
00237 }
00238 
00239 template<int DIM>
00240 double LevelAdaptiveData<DIM>::Max() {
00241  double s=-1e+100,r ;
00242  Matrix<Matrix<double,DIM> * , DIM>::iterator it(a) ;
00243  for (it=(*a).begin(); it<=(*a).end(); ++it) 
00244    if ((*(G->a))[it.i]) { r=(*a)[it]->Max() ; s = max(s,r) ; }
00245  return max(s,Ext.Max()) ;
00246 }
00247 
00248 template<int DIM>
00249 double LevelAdaptiveData<DIM>::Min() {
00250  double s=+1e+100,r ;
00251  Matrix<Matrix<double,DIM> * , DIM>::iterator it(a) ;
00252  for (it=(*a).begin(); it<=(*a).end(); ++it) 
00253    if ((*(G->a))[it.i]) { r=(*a)[it]->Max() ; s = min(s,r) ; }
00254  return  min(s,Ext.Min()) ;
00255 }
00256 
00257 template<int DIM>
00258 double LevelAdaptiveData<DIM>::MaxAbs() {
00259  double s=-1e+100,r ;
00260  Matrix<Matrix<double,DIM> * , DIM>::iterator it(a) ;
00261  for (it=(*a).begin(); it<=(*a).end(); ++it) 
00262    if ((*(G->a))[it.i]) { r=(*a)[it]->MaxAbs() ; s = max(s,r) ; }
00263  return max(s,Ext.MaxAbs()) ;
00264 }
00265 
00266 template<int DIM>
00267 void LevelAdaptiveData<DIM>::Set(const double c) {
00268  Matrix<Matrix<double,DIM> * , DIM>::iterator it(a) ;
00269  for (it=(*a).begin(); it<=(*a).end(); ++it) 
00270    if ((*(G->a))[it.i]) (*a)[it]->Set(c) ;
00271  Ext.Set(0) ;
00272 }
00273 
00274 
00275 //
00276 // Matrix and IO
00277 //
00278 
00279 template<int DIM>
00280 void LevelAdaptiveData<DIM>::FromUniform(UniformData<DIM> *M) {
00281  FromUniform(M->ba) ;
00282  Ext.CopyFlags(&M->Ext) ;
00283  Ext.CopyData (&M->Ext) ;
00284 }
00285 
00286 template<int DIM>
00287 void LevelAdaptiveData<DIM>::FromUniform(Matrix<double,DIM> *M) { 
00288  int i,JM[DIM] ;
00289 
00290  M->CalcLevel(JM) ;
00291 
00292  Matrix<Matrix<double,DIM> * , DIM>::iterator it(a) ;
00293  for (it=(*a).begin(); it<=(*a).end(); ++it) {
00294    bool inner=true ;
00295    for (i=0; i<DIM; i++) if (it.i[i]>JM[i]) inner=false ;
00296    if ( (*G->a)[it.i] && inner ) {
00297      // copy submatrices
00298      int im[DIM] ;
00299      Matrix<double,DIM> *ait=(*a)[it] ;
00300      Matrix<double,DIM>::iterator in( ait ) ;
00301      for (in=(*ait).begin(); in <= (*ait).end(); ++in) { 
00302        for (i=0; i<DIM; i++) im[i]=in.i[i] + ( (it.i[i]==Level0[i]) ?  0 : (1<<(it.i[i]-1))+1 ) ;
00303        (*ait)[in] = (*M)[im] ;
00304       }
00305     }
00306   }
00307 }
00308 
00309 
00310 template<int DIM>
00311 void LevelAdaptiveData<DIM>::ToUniform(UniformData<DIM> *M) {
00312  ToUniform(M->ba) ;
00313  M->Ext.CopyFlags(&Ext) ;
00314  M->Ext.CopyData (&Ext) ;
00315 }
00316 
00317 template<int DIM>
00318 void LevelAdaptiveData<DIM>::ToUniform(Matrix<double,DIM> *M) {
00319  int i,JM[DIM] ;
00320 
00321  M->CalcLevel(JM) ;
00322  M->Set(0.0) ;
00323 
00324  Matrix<Matrix<double,DIM> * , DIM>::iterator il(a) ;
00325  for (il=(*a).begin(); il<=(*a).end(); ++il) {
00326    bool inner=true ;
00327    for (i=0; i<DIM; i++) if (il.i[i]>JM[i]) inner=false ;
00328    if ( (*G->a)[il.i] && inner ) {
00329      // copy submatrices
00330      int is[DIM] ;
00331      Matrix<double,DIM> *ail=(*a)[il] ;
00332      Matrix<double,DIM>::iterator it( ail ) ;
00333      for (it=(*ail).begin(); it <= (*ail).end(); ++it) { 
00334        for (i=0; i<DIM; i++) is[i]=it.i[i] + ( (il.i[i]==G->Level0[i]) ?  0 : (1<<(il.i[i]-1)) + 1 ) ;
00335        (*M)[is] = (*ail)[it] ;
00336       }
00337     }
00338   }
00339 }
00340 
00341 
00342 // WriteUDF
00343 template<int DIM>
00344 void LevelAdaptiveData<DIM>::WriteUDF(const char *name, int  *L, LevelAdaptiveData<DIM> *Tmp, bool CastToFloat) {
00345   int a[DIM]={0},e[DIM],i ;
00346   for (i=0; i<DIM; i++) e[i]=1<<L[i] ;
00347   UniformData <DIM> M(a,e,Ext.WC) ;
00348   WriteUDF(name,&M,Tmp,CastToFloat) ;
00349 }
00350 
00351 template<int DIM>
00352 void LevelAdaptiveData<DIM>::WriteUDF(const char *name, int  L, LevelAdaptiveData<DIM> *Tmp, bool CastToFloat) {
00353   int LL[DIM],i ;
00354   for (i=0; i<DIM; i++) LL[i]=L ;
00355   WriteUDF(name,LL,Tmp,CastToFloat) ;
00356 }
00357 
00358 
00359 template<int DIM>
00360 void LevelAdaptiveData<DIM>::WriteUDF(const char *name, UniformData<DIM> *M, LevelAdaptiveData<DIM> *Tmp, bool CastToFloat) {
00361   int  i,BG[DIM][2],L[DIM] ;
00362   LevelAdaptiveData<DIM> *X=this ;
00363 
00364   // change of basis to Interpolets without boundary conditions
00365   if (Tmp) {
00366     for (i=0; i<DIM; i++) {
00367       assert(Ext.ismultiscale[i]) ;
00368       if (Ext.islifting[i]) {
00369         Tmp->ApplyOp( Ext.BC[i] , X , i, LIFTING2INTERPOLET) ;
00370         X=Tmp ;
00371       }
00372     }
00373     for (i=0; i<DIM; i++) {
00374       GetGeneralBoundaryConditions(Ext.BC[i],BG[i]) ;    
00375       Tmp->ApplyOp( BG[i] , X , i, PROJECTION) ;
00376       X=Tmp ;
00377     }
00378   }
00379 
00380   ToUniform(M) ;
00381   if (Tmp) for (i=0; i<DIM; i++) M->ApplyOp(BG[i], M, i, INVERSETRANSFORM) ;
00382 
00383   M.WriteUDF(name,NULL,CastToFloat) ;
00384 }
00385 
00386 
00387 
00388 //
00389 // Operators
00390 //
00391 template<int DIM>
00392 void LevelAdaptiveData<DIM>::ApplyOp(  LevelAdaptiveData<DIM> *S , int dir , unsigned int op) {
00393  ApplyOp( BC[dir] , S, dir , op) ;
00394 }
00395 
00396 template<int DIM>
00397 void LevelAdaptiveData<DIM>::ApplyOp(int *BCto , LevelAdaptiveData<DIM> *S , int dir , unsigned int op) {
00398  // check
00399  assert(A==S->A) ;
00400  assert(dir<DIM) ;
00401 
00402  int i,m=0 ;
00403  // allocate aux. vectors ;
00404  for (i=0; i<DIM; i++) m=max(m , G->J[i]) ;
00405  double s[(1<<m)+1] , t[(1<<m)+1] ;
00406 
00407  // forall ProjectionSubSpaces
00408  Matrix<Matrix<double,DIM> * , DIM>::iterator il(G->Level0,G->J,dir) ;
00409  for (il.Set(Level0); il<=(*a).end(); ++il) {
00410 
00411    // forall entries in each ProjectionSubSpaces 
00412    Matrix<double,DIM> *ail=(*a)[il] ;
00413    if ((*G->a)[il.i]) {
00414      assert (ail) ;
00415      Matrix<double,DIM>::iterator it( ail , dir ) ;
00416 
00417      for(it=(*ail).begin(dir); it <= (*ail).end(); ++it) {
00418 
00419        // copy one line
00420        int is[DIM],ik[DIM],JJ=0 ;
00421        int n=0     ;
00422        for (i=0; i<DIM; i++) { is[i]=it.i[i] ; ik[i]=il.i[i] ; }
00423        for (ik[dir]=0; ik[dir]<=G->J[dir]; ik[dir]++)
00424          if ((*G->a)[ik]) {
00425            Matrix<double,DIM> *aik=(*S->a)[ik] ;
00426            assert(aik) ;
00427            int e = (ik[dir]==Level0[dir]) ? (1<<Level0[dir]) : (1<<(ik[dir]-1)) -1 ;
00428            for (is[dir]=0; is[dir]<=e; is[dir]++) s[n++] = (*aik)[is] ;
00429            JJ=ik[dir] ;
00430          }
00431 
00432        // apply operation
00433        switch (op) {
00434          case STIFFNESS: case FIRSTDERIVATIVE: case FD12: case FD14: case FD22: case FD24: case FD16: 
00435          case DIV: case GRAD: case PROJECTION: {
00436            assert(!WC->InterpoletFlag) ;
00437            ibwt   (t,S->BC[dir] , &m  , s, S->BC[dir] , WC , JJ , JJ-G->Level0[dir] , 0) ;
00438            applyOp(s,BCto       , NULL, t, S->BC[dir] , WC , JJ , op                , Ext.XE[dir]-Ext.XA[dir]) ;
00439            bwt    (t,BCto       , &m  , s, BCto       , WC , JJ , JJ-G->Level0[dir] , 0) ;
00440           } break ;
00441          
00442          default: assert(0) ;
00443        }
00444 
00445        // write back result
00446        n=0 ;
00447        for (ik[dir]=0; ik[dir]<=G->J[dir]; ik[dir]++)
00448          if ((*G->a)[ik]) {
00449            Matrix<double,DIM> *aik=(*a)[ik] ;
00450            int e = (ik[dir]==G->Level0[dir]) ? (1<<G->Level0[dir]) : (1<<(ik[dir]-1)) -1 ;
00451            for (is[dir]=0; is[dir]<=e; is[dir]++) (*aik)[is] = t[n++] ;
00452          }
00453 
00454        } // next line 
00455      }   // if ()
00456    }     // next ProjectionSubSpace
00457 
00458  // Boundary Conditions 
00459  Ext.CopyFlags(&S->Ext) ;
00460  Ext.SetBoundaryConditions(dir,BCto[0] , BCto[1]) ;
00461 }
00462 
00463 
00464 template<int DIM>
00465 void LevelAdaptiveData<DIM>::Blend(BlendingData<DIM> *B) {
00466  int i,la[DIM],sa[DIM],se[DIM],ta[DIM],te[DIM] ;
00467 
00468  // check
00469  for (i=0; i<DIM; i++) {
00470    la[i]=Ext.WC->Level0 ;
00471    assert(B->Ext.ismultiscale[i]) ;
00472  }
00473 
00474  // init. 
00475  Set(0.0) ;
00476  double w ;
00477 
00478  // forall active BlendingSpaces
00479  Matrix<Matrix<double,DIM> * , DIM>::iterator k(B->a) ;
00480  for (k=(*B->a).begin(); k<=(*B->a).end(); ++k) {
00481    if ( (w=(*B->A->a)[k.i]) != 0) {
00482      Matrix<double,DIM> *ak=(*B->a)[k] ;
00483      assert (ak) ;
00484      
00485      Matrix<Matrix<double,DIM> * , DIM>::iterator l(la, k.i) ;
00486      for (l.Set(la);  l<=k.i; ++l) {
00487        for (i=0; i<DIM; i++)
00488          if (l.i[i]==la[i]) {
00489            sa[i]=ta[i]=0        ;
00490            se[i]=te[i]=1<<la[i] ;
00491          } else {
00492            sa[i]=(1<<(l.i[i]-1))+1 ;
00493            se[i]= 1<<l.i[i]        ;
00494            ta[i]=0                 ;
00495            te[i]=se[i]-sa[i]       ;
00496          }
00497        
00498        Matrix<double , DIM>::iterator s(sa, se) ;
00499        Matrix<double , DIM>::iterator t(ta, te) ;
00500        Matrix<double , DIM> *al= (*a)[l] ;
00501        assert(al) ;
00502        for (s.Set(sa), t.Set(ta); s<=se; ++s,++t) (*al)[t] += w * (*ak)[s] ;
00503 
00504      } // l
00505    }   // if ()
00506  }     // next BlendingSpace
00507 
00508  Ext.CopyFlags(&B->Ext) ;
00509  Ext.CopyData (&B->Ext) ;
00510 }
00511 
00512 
00513 template<int DIM>
00514 void LevelAdaptiveData<DIM>::Multiply(LevelAdaptiveData<2*DIM> *K , LevelAdaptiveData<DIM> *S) {
00515 
00516   if (Ext.WC->InterpoletFlag) {
00517     std::cout <<"LevelAdaptiveData<DIM>::Multiply supported for orthogonal Daubechies wavelets only!\n" ;
00518     assert(0) ;
00519   }
00520 
00521  int i  ;
00522  double w ;
00523  for (i=0; i<DIM; i++) {
00524    assert(S->Ext.BC[i][0] == K->Ext.BC[DIM+i][0]) ;
00525    assert(S->Ext.BC[i][1] == K->Ext.BC[DIM+i][1]) ;
00526 
00527    assert(S->Ext.ismultiscale[i]) ;
00528    assert(K->Ext.ismultiscale[i]) ;
00529    assert(K->Ext.ismultiscale[DIM+i]) ;
00530 
00531    Ext.ismultiscale[i]=true ;
00532    Ext.BC[i][0]=K->Ext.BC[i][0] ;
00533    Ext.BC[i][1]=K->Ext.BC[i][1] ;
00534  }
00535 
00536  // forall SubSpaces of (*this)
00537  Matrix<Matrix<double,DIM> * , DIM>::iterator l(a) ;
00538  for (l=(*a).begin(); l<=(*a).end(); ++l) {
00539    // forall entries in each SubSpace 
00540    if ( (*G->a)[l.i] ) {
00541      Matrix<double,DIM> *al=(*a)[l] ;
00542      Matrix<double,DIM>::iterator s(al) ;
00543      for (s=(*al).begin(); s<= (*al).end(); ++s) {
00544        w=0 ;
00545        // forall SubSpaces in S with active K(.,S)
00546        Matrix<Matrix<double,DIM> * , DIM>::iterator Sl(S->a) ;
00547        for (Sl=(*S->a).begin(); Sl<=(*S->a).end(); ++Sl) { 
00548          Matrix<double,DIM> *Sal=(*S->a)[Sl] ;
00549          // joint level for K
00550          int                 Kl[2*DIM] , Ks[2*DIM] ;
00551          for (i=0; i<DIM; i++) {
00552            Kl[i    ]= l.i[i] ;
00553            Kl[DIM+i]=Sl.i[i] ;
00554            Ks[i    ]= s.i[i] ;
00555          }
00556 
00557          if ( (*S->G->a)[Sl.i] && (*K->G->a)[Kl] ) {
00558 
00559            Matrix<double,2*DIM> *Kal=(*K->a)[Kl] ;
00560            Matrix<double,DIM>::iterator Ss(Sal) ;
00561            for (Ss=(*Sal).begin(); Ss<= (*Sal).end(); ++Ss) {
00562               // joint spatial index  
00563               for (i=0; i<DIM; i++) Ks[DIM+i]=Ss.i[i] ;
00564               w +=(*Kal)[Ks]*(*Sal)[Ss] ;
00565            }  // next Ss
00566 
00567          }    // if 
00568        }      // next Sl
00569 
00570        // Der Lohn der Muehen:
00571        (*al)[s]=w ;
00572      }        // next s
00573    }          // if
00574  }            // next l
00575 
00576 }
00577 
00578 #endif

Generated at Mon Aug 19 10:02:31 2002 for AWFD by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001