95 if (test==cur->getFace())
101 if (test==cur->getFace() && l==cur->getLoc())
114 if (in==cur->getFace())
115 return cur->getLoc();
122 else printf(
"Empty.\n");
130 return abs(dir[0])+
abs(dir[1])+
abs(dir[2]);
146 const int expectedHops[nNodes]={0,1,1,2};
155 if (tFace==notHim)
continue;
161 for (l=1;l<nNodes && isPresent;l++)
165 if (c->getFace()!=tFace)
169 if (
nHops(dir)==expectedHops[l]) {
171 if (l==1) orientX=dir;
172 if (l==2) orientY=dir;
175 if (!inList) isPresent=
false;
180 if (retLoc!=NULL) *retLoc=tLoc;
181 if (oX!=NULL) *oX=orientX;
182 if (oY!=NULL) *oY=orientY;
210 const double safetyFactor=5;
211 double mag=safetyFactor*v.
mag();
212 while (mag*
scale>1.0e9) {
214 double newQuant=1.0/
scale;
216 printf(
"Encountered large node coordinates: quantizing to %.3g\n",newQuant);
245 :dim(dim_), originalNo(orig),blockNo(blockNo_), nodeLocs(nodeLocs_)
266 if (faceNo==-1) {fprintf(stderr,
"Boundary condition is volumetric!\n");abort();}
294 "iMin",
"jMin",
"kMin",
306 for (
int axis=0;axis<3;axis++)
308 fprintf(stderr,
"ERROR! Block %d's side is %d long.\n",
330 printf(
"%.1f MB: (%d blocks serving %d allocd/%d freed)\n",
335 void memStats(
void) {
336 printf(
"blocks> %.1f MB\n",
blockBytes*1.0e-6);
337 printf(
"adjRecs> ");poolStats(adjRec::pool);
338 printf(
"nodes> ");poolStats(node::pool);
343 printf(
"(%d %d) (%d %d) (%d %d)\n",
344 1+a[0],1+b[0],1+a[1],1+b[1],1+a[2],1+b[2]);
347 void printPatch(
const patch &p)
353 printf(
" -> exterior\n");
355 printf(
" -> %d's ",p.dest->getBlockNumber()+1);
357 printf(
" Orient=(%d %d %d)\n",
358 1+p.orient[0],1+p.orient[1],1+p.orient[2]);
362 int main(
int argc,
char *argv[])
364 if (argc<2) {printf(
"Usage: test <.grd file>\n");
return 1;}
368 printf(
"Starting read...\n");
369 if (NULL!=(err=r.read(argv[1])))
370 printf(
"ERROR! %s\n",err);
372 printf(
"File read successfully.\n");
377 for (
int bn=0;bn<blocks.size();bn++) {
384 vector<patch> patches;
386 for (
int p=0;p<patches.size();p++)
387 printPatch(patches[p]);
const double initNodeQuant
void addBC(const blockSpan &span, int bcNo)
const vector< patch * > & getPatches(void) const
vector< externalBCpatch > BCs[nFaces]
void addFace(face *b, const blockLoc &l)
static allocPool< adjRec > pool
block * getBlock(void) const
node * loc2node(const vector3d &loc)
int nHops(const blockLoc &dir)
void multigridError(void)
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
CkHashtableTslow< hashableVector3d, node * > map
bool hasFace(const face *test) const
static allocPool< node > pool
vector< block * > & blocks
static void printSpan(FILE *out, const blockSpan &sp)
const blockLoc & getLoc(const face *b) const
static const char * face2name[nFaces]
static void checkVector(const vector3d &v)
bool hasLoc(const face *test, const blockLoc &l) const
virtual void freeBlock(vector3d *locs)
bool blocks
Input data is block-structured grid.
int getLength(void) const
int main(int argc, char *argv[])
static T_VertexSet * face
static face * intersect(const node **nodes, const face *notHim=NULL, blockLoc *loc=NULL, blockLoc *oX=NULL, blockLoc *oY=NULL)
virtual const char * consume(const blockDim &dim, vector3d *locs)
hashableVector3d(const vector3d &v)
void buildFaces(nodeMatcher &map)
block(const blockDim &dim_, int originalNo_, int blockNo_, vector3d *nodeLocs_)
int getBlockNumber(void) const