AMROC Main     Blockstructured Adaptive Mesh Refinement in object-oriented C++


Main Page   Class Hierarchy   Compound List   File List  

Cluster1.C

Go to the documentation of this file.
00001 
00008 #include "DAGH.h"
00009 #include "values.h"
00010 
00011 #ifdef __KCC
00012  template class GridData(1)<short>;
00013 #endif
00014 
00028 void Cluster1(GridData(1)<short> &flag,
00029               BBoxList& bblexclude, 
00030               double Efficiency,
00031               int MinWidth,
00032               int MaxWidth,
00033               int BufferWidth,
00034               BBoxList &result) {
00035   GridData(1)<short> newflag(flag.bbox());
00036   int l=-1, u=-1;
00037 
00038   /* First buffer! */
00039   newflag = 0;
00040 
00041   for_1(i,flag.bbox(),flag.bbox().stepsize()) 
00042     if (flag(i)) {
00043       BBox where(1,i,i,flag.bbox().stepsize(0));
00044       where.grow(BufferWidth);
00045       newflag.equals(1,where);
00046     }
00047   end_for;
00048 
00049   for (BBox *bbex=bblexclude.first();bbex;bbex=bblexclude.next()) 
00050     newflag.equals(0,*bbex);
00051   
00052   /* Now just step along looking for zero crossings or end of
00053      the thing.  This defines our BBox */
00054   if (newflag(newflag.bbox().lower(0))) {
00055     l = newflag.bbox().lower(0);
00056   }
00057   int i;
00058   for (i=newflag.bbox().lower(0)+newflag.bbox().stepsize(0); 
00059        i < newflag.bbox().upper(0); 
00060        i+= newflag.bbox().stepsize(0)) {
00061     if (newflag(i)>0 && !newflag(i-newflag.bbox().stepsize(0))) {
00062       l = i;
00063     }
00064     if (!newflag(i) && newflag(i-newflag.bbox().stepsize(0))) {
00065       u = i-newflag.bbox().stepsize(0);
00066       BBox add(1,l,u,newflag.bbox().stepsize(0));
00067       if (add.size() >= MinWidth) {
00068         result.add(add);
00069       }
00070     }
00071   }
00072   if (u < l) {
00073     u = newflag.bbox().upper(0);
00074     BBox add(1,l,u,newflag.bbox().stepsize(0));
00075     result.add(add);
00076   }
00077 }
00078 


Quickstart     Users Guide     Programmers Reference     Installation      Examples     Download



AMROC Main      Home      Contact
last update: 06/01/04