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  

DataGroup.hpp

00001 #ifndef _DATA_GROUP_
00002 # define _DATA_GROUP_
00003 
00004 template<int DIM>
00005 struct AdaptiveData;
00006 
00007 template<int DIM>
00008 struct DataGroup {
00009   int count     ;
00010   AdaptiveData<DIM> *Ds[100] ;
00011 
00012        DataGroup() ;
00013   void Insert(AdaptiveData<DIM> *X) ;
00014   void Remove(AdaptiveData<DIM> *X) ;
00015   void Print (char *str) ;
00016 } ;
00017 
00018 
00020 //                   //
00021 //  Implementations  //
00022 //                   //
00024 
00025 template<int DIM>
00026 DataGroup<DIM>::DataGroup() { count=0; }
00027 
00028 template<int DIM>
00029 void DataGroup<DIM>::Insert(AdaptiveData<DIM> *X) {
00030   int i=0 ;
00031   while (i<count) {
00032     if (Ds[i]==X) return ;
00033     i++ ;
00034   }
00035   Ds[count++]=X ;
00036 }
00037 
00038 template<int DIM>
00039 void DataGroup<DIM>::Remove(AdaptiveData<DIM> *X) {
00040   int i=0,j ;
00041   while (i<count) {
00042     if (Ds[i]==X) {
00043       for (j=i+1; j<count; j++) Ds[j-1]=Ds[j] ;
00044       count-- ;
00045       return  ;
00046     }
00047     i++ ;
00048   }
00049 }
00050 
00051 template<int DIM>
00052 void DataGroup<DIM>::Print(char *str) {
00053   int i ;
00054   for (i=0; i<count; i++) std::cout<<str<<' '<<i<<' '<<Ds[i]<<'\n' ;
00055 }
00056 
00057 
00058 #endif

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