00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef AMROC_VISUALGRID_H
00010 #define AMROC_VISUALGRID_H
00011
00019 #include "VisualGridBase.h"
00020 #include "HierarchyStorage.h"
00021 #include "VisualGridData.h"
00022 #include "Evaluator.h"
00023
00024 #include "BBoxList.h"
00025 #include "DAGHDefaults.h"
00026
00027 #include <vector>
00028 #include <utility>
00029 #include <map>
00030 #include <functional>
00031 #include <algorithm>
00032 #include <iostream>
00033 #include <string>
00034 #include <cstdio>
00035 #include <cfloat>
00036
00043 template <class VectorType>
00044 class VisualGrid : public VisualGridBase {
00045 typedef typename VectorType::InternalDataType DataType;
00046
00047 public:
00048 typedef VisualGridData<VectorType> data_block_type;
00049 typedef std::vector<data_block_type*> block_list_type;
00050 typedef HierarchyStorage<DataType> hierarchy_storage_type;
00051 typedef typename hierarchy_storage_type::data_block_type hdata_block_type;
00052 typedef typename hierarchy_storage_type::block_list_type hblock_list_type;
00053 typedef typename hblock_list_type::iterator hblock_list_iterator;
00054 typedef typename data_block_type::direction direction;
00055 typedef std::pair<int, int> node_pair_type;
00056 typedef std::multimap<int, int> node_pair_list_type;
00057 typedef std::vector<float> point_list_type;
00058 typedef Evaluator<VectorType> evaluator_type;
00059 typedef VisualGridBase vgridbase_type;
00060
00061 VisualGrid(evaluator_type* ev) :
00062 vgridbase_type(ev), _FKeys(1), _MinLevel(0), _MaxLevel(0), _NLevels(1), _MaxProcs(1024),
00063 StepFormat(0), StepDirectories(0), NoTimeRefine(0), _CutOut(1), _Eliminate(1), _EliminateValue(-1.e37),
00064 _parData(0) {
00065 PlotLevel = new int[NLevels()];
00066 int i;
00067 for (i=0; i<NLevels(); i++)
00068 PlotLevel[i] = 0;
00069
00070 VectorType dummy;
00071 VectorLength = dummy.length();
00072 CompName = new std::string[VectorLength];
00073 CompDir = "-";
00074 CompRead = new bool[VectorLength];
00075 for (i=0; i<VectorLength; i++)
00076 CompRead[i] = false;
00077 for (i=0; i<3; i++) {
00078 Symmetry[i] = 0; Periodic[i] = 0;
00079 show[2*i] = 0; show[2*i+1] = -1.0; cut[i] = FLT_MAX;
00080 show_exact[i] = 0;
00081 }
00082 DimUsed = Coords(3,1);
00083 Make3d = false;
00084 InitWholeVector = false;
00085 RestrictData = 0;
00086 for (i=0; i<DAGHMaxLevels; i++)
00087 _RefineFactor[i] = DAGHDefaultRefineFactor;
00088
00089 _where = new BBox[MAXLEV];
00090 _to = new BBox[MAXLEV];
00091 _from = new BBox[MAXLEV];
00092 for (register int l=0; l<MAXLEV; l++) {
00093 _where[l] = BBox(3,1);
00094 _where[l].lower(1) = 0; _where[l].lower(2) = 0;
00095 _where[l].upper(1) = 0; _where[l].upper(2) = 0;
00096 _to[l] = BBox(3,1);
00097 _to[l].lower(1) = 0; _to[l].lower(2) = 0;
00098 _to[l].upper(1) = 0; _to[l].upper(2) = 0;
00099 _from[l] = BBox(3,1);
00100 _from[l].lower(1) = 0; _from[l].lower(2) = 0;
00101 _from[l].upper(1) = 0; _from[l].upper(2) = 0;
00102 }
00103 }
00104
00105 ~VisualGrid() {
00106 delete PlotLevel;
00107 delete [] CompName;
00108 delete [] CompRead;
00109 delete [] _where;
00110 delete [] _to;
00111 delete [] _from;
00112 }
00113
00114
00115
00116
00117 virtual void BlockListAppend(hdata_block_type& workdata, BBox& bb, int comp, int& Level,
00118 int& proc, float* dx, float* geom) = 0;
00119
00120
00121 virtual void register_at(ControlDevice& Ctrl, const std::string& prefix) {
00122 ControlDevice GHCtrl = Ctrl.getSubDevice("GridHierarchy");
00123 char VariableName[32];
00124 for (int d=0; d<3; d++) {
00125 std::sprintf(VariableName,"Cells(%d)",d+1);
00126 RegisterAt(GHCtrl,VariableName,shape[d]);
00127 std::sprintf(VariableName,"GeomMin(%d)",d+1);
00128 RegisterAt(GHCtrl,VariableName,geom[2*d]);
00129 std::sprintf(VariableName,"GeomMax(%d)",d+1);
00130 RegisterAt(GHCtrl,VariableName,geom[2*d+1]);
00131 }
00132 RegisterAt(GHCtrl,"MaxLevels",_NLevels);
00133 for (register int i=0; i<DAGHMaxLevels; i++) {
00134 std::sprintf(VariableName,"RefineFactor(%d)",i+1);
00135 RegisterAt(GHCtrl,VariableName,_RefineFactor[i]);
00136 }
00137 RegisterAt(Ctrl,"NoTimeRefine",NoTimeRefine);
00138
00139 ControlDevice FilesCtrl = Ctrl.getSubDevice("Files");
00140 for (int comp=0; comp<VectorLength; comp++) {
00141 char ComponentName[16];
00142 std::sprintf(ComponentName,"-");
00143 CompName[comp] = ComponentName;
00144 std::sprintf(ComponentName,"OutputName(%d)",comp+1);
00145 RegisterAt(FilesCtrl,ComponentName,CompName[comp]);
00146 }
00147 RegisterAt(FilesCtrl,"OutputDirectory",CompDir);
00148 RegisterAt(FilesCtrl,"StepFormat",StepFormat);
00149 RegisterAt(FilesCtrl,"StepDirectories",StepDirectories);
00150 }
00151 virtual void register_at(ControlDevice& Ctrl) {
00152 register_at(Ctrl, ""); }
00153
00154 virtual void update() {
00155 std::string iname;
00156 if (UpdateName()) iname = *UpdateName();
00157 else iname = "display.in";
00158 ControlDevice DisplayCtrl(GetFileControlDevice(iname.c_str(),""));
00159 RegisterAt(DisplayCtrl,"Type",_FKeys);
00160 RegisterAt(DisplayCtrl,"DisplayMinLevel",_MinLevel);
00161 RegisterAt(DisplayCtrl,"DisplayMaxLevel",_MaxLevel);
00162 RegisterAt(DisplayCtrl,"CutOut",_Eliminate);
00163 RegisterAt(DisplayCtrl,"CutOutValue",_EliminateValue);
00164 RegisterAt(DisplayCtrl,"MaxProcs",_MaxProcs);
00165 delete PlotLevel;
00166 PlotLevel = new int[NLevels()];
00167 for (int lev=0; lev<NLevels(); lev++) {
00168 char LevelName[16];
00169 std::sprintf(LevelName,"PlotGrid(%d)",lev);
00170 RegisterAt(DisplayCtrl,LevelName,PlotLevel[lev]);
00171 }
00172 for (int d=0; d<3; d++) {
00173 char VariableName[16];
00174 std::sprintf(VariableName,"ShowMin(%d)",d+1);
00175 RegisterAt(DisplayCtrl,VariableName,show[2*d]);
00176 std::sprintf(VariableName,"ShowMax(%d)",d+1);
00177 RegisterAt(DisplayCtrl,VariableName,show[2*d+1]);
00178 std::sprintf(VariableName,"ShowCut(%d)",d+1);
00179 RegisterAt(DisplayCtrl,VariableName,cut[d]);
00180 std::sprintf(VariableName,"Symmetry(%d)",d+1);
00181 RegisterAt(DisplayCtrl,VariableName,Symmetry[d]);
00182 std::sprintf(VariableName,"Periodic(%d)",d+1);
00183 RegisterAt(DisplayCtrl,VariableName,Periodic[d]);
00184 }
00185
00186 ControlDevice WhereCtrl, ToCtrl, FromCtrl;
00187 for (register int l=0; l<MAXLEV; l++) {
00188 char devno[8];
00189 std::sprintf(devno,"(%d)",l);
00190 WhereCtrl = DisplayCtrl.getSubDevice("Where"+std::string(devno));
00191 for (int d=0; d<3; d++) {
00192 char text[8];
00193 std::sprintf(text,"lb(%d)",d+1);
00194 RegisterAt(WhereCtrl,text,_where[l].lower(d));
00195 std::sprintf(text,"ub(%d)",d+1);
00196 RegisterAt(WhereCtrl,text,_where[l].upper(d));
00197 std::sprintf(text,"s(%d)",d+1);
00198 RegisterAt(WhereCtrl,text,_where[l].stepsize(d));
00199 }
00200 ToCtrl = DisplayCtrl.getSubDevice("To"+std::string(devno));
00201 for (int d=0; d<3; d++) {
00202 char text[8];
00203 std::sprintf(text,"lb(%d)",d+1);
00204 RegisterAt(ToCtrl,text,_to[l].lower(d));
00205 std::sprintf(text,"ub(%d)",d+1);
00206 RegisterAt(ToCtrl,text,_to[l].upper(d));
00207 std::sprintf(text,"s(%d)",d+1);
00208 RegisterAt(ToCtrl,text,_to[l].stepsize(d));
00209 }
00210 FromCtrl = DisplayCtrl.getSubDevice("From"+std::string(devno));
00211 for (int d=0; d<3; d++) {
00212 char text[8];
00213 std::sprintf(text,"lb(%d)",d+1);
00214 RegisterAt(FromCtrl,text,_from[l].lower(d));
00215 std::sprintf(text,"ub(%d)",d+1);
00216 RegisterAt(FromCtrl,text,_from[l].upper(d));
00217 std::sprintf(text,"s(%d)",d+1);
00218 RegisterAt(FromCtrl,text,_from[l].stepsize(d));
00219 }
00220 }
00221 RegisterAt(DisplayCtrl,"RestrictData",RestrictData);
00222
00223 TheEvaluator().register_at(DisplayCtrl,"");
00224 DisplayCtrl.update();
00225
00226 TheEvaluator().update();
00227 }
00228
00229 virtual int SetUp(int step, std::string** filenames, int Nfilenames) {
00230 vgridbase_type::SetUp(step,filenames,Nfilenames);
00231 bool initialize = true;
00232
00233 if (initialize) {
00234 for (register int i=0; i<NLevels()-1; i++)
00235 if (_RefineFactor[i] < 1)
00236 _RefineFactor[i] = 1;
00237 _RefineFactor[NLevels()-1] = 1;
00238 int d, ii;
00239 for (ii=1; ii<NLevels(); ii++)
00240 for (d=0; d<3; d++)
00241 shape[d] *= _RefineFactor[ii-1];
00242
00243 float dm = 1.e37;
00244 for (d=0; d<3; d++) {
00245 dx[d] = (geom[2*d+1]-geom[2*d]) / shape[d];
00246 if (dx[d]>0. && dx[d]<dm) dm = dx[d];
00247 }
00248 for (d=0; d<3; d++) {
00249 if (dx[d] <= 0.0) {
00250 DimUsed(d) = 0;
00251 dx[d] = (InitWholeVector ? 1. : dm);
00252 shape[d] = 1;
00253 for (int comp=VectorLength-1; comp>d; comp--)
00254 CompName[comp] = CompName[comp-1];
00255 if (VectorLength >= 4)
00256 CompName[d+1] = "-";
00257 }
00258 }
00259
00260 for (d=0; d<3; d++) {
00261 if (Symmetry[d] != 0) {
00262 shape[d] += shape[d];
00263 if (Symmetry[d] > 0)
00264 geom[2*d+1] += geom[2*d+1]-geom[2*d];
00265 else
00266 geom[2*d] -= geom[2*d+1]-geom[2*d];
00267 }
00268 else if (Periodic[d] > 0) {
00269 shape[d] += Periodic[d]*shape[d];
00270 geom[2*d+1] += Periodic[d]*(geom[2*d+1]-geom[2*d]);
00271 }
00272 }
00273
00274 for (d=0; d<3; d++) {
00275 if (DimUsed(d) && cut[d]>=geom[2*d] && cut[d]<=geom[2*d+1]) {
00276 show[2*d] = cut[d];
00277 show[2*d+1] = cut[d];
00278 show_exact[d] = 1;
00279 }
00280 if (DimUsed(d)==0 || show[2*d]>show[2*d+1]) {
00281 show_shape[2*d] = 0;
00282 show_shape[2*d+1] = shape[d];
00283 }
00284 else {
00285 show_shape[2*d] = int((Max(show[2*d],geom[2*d])-
00286 geom[2*d]) / dx[d]);
00287 show_shape[2*d+1] = int((Min(show[2*d+1],geom[2*d+1])-
00288 geom[2*d]+dx[d]/2.0) / dx[d]);
00289 }
00290 }
00291 }
00292
00293 int i;
00294 for (i=0; i<Nfilenames; i++)
00295 CompName[i] = *filenames[i];
00296 for (i=0; i<VectorLength; i++) {
00297 if (CompName[i].c_str()[0] == '-')
00298 continue;
00299
00300 char ioname[DAGHBktGFNameWidth+16];
00301 OutputFileName(ioname,CompName[i].c_str(),step);
00302 hierarchy_storage_type* HS = new hierarchy_storage_type(NLevels());
00303 _parData=HS->ReadIn(ioname, _RefineFactor, Dimensions(),
00304 Symmetry, Periodic,
00305 _Eliminate, _EliminateValue, MaxProcs(),
00306 _where, _to, _from, RestrictData);
00307 if (_parData >= 0) {
00308 CompRead[i] = true;
00309 if (HS->RealTime() >= _RealTime) _RealTime = HS->RealTime();
00310 std::cerr << "Reading Component " << i << " : " << CompName[i]
00311 << " at " << RealTime() << std::endl;
00312 }
00313
00314 int* NCells = new int[MaxProcs()*NLevels()];
00315 int pc, Level;
00316 for (pc=0; pc<MaxProcs()*NLevels(); pc++) NCells[pc] = 0;
00317 for (Level=0; Level<NLevels(); Level++)
00318 for (hblock_list_iterator hsbit=HS->BlockList(Level).begin();
00319 hsbit!=HS->BlockList(Level).end(); hsbit++)
00320 NCells[MaxProcs()*Level+(*hsbit).second] +=
00321 (*hsbit).first->bbox().size();
00322 int* WCells = new int[MaxProcs()];
00323 int* Work = new int[MaxProcs()];
00324 int WholeCells = 0, WholeWork = 0, NProcs = 0;
00325 for (pc=0; pc<MaxProcs(); pc++) {
00326 WCells[pc] = NCells[pc];
00327 Work[pc] = NCells[pc];
00328 int fac = 1;
00329 for (Level=1; Level<NLevels(); Level++) {
00330 if (NoTimeRefine!=1) fac *= RefineFactor(Level-1);
00331 WCells[pc] += NCells[MaxProcs()*Level+pc];
00332 Work[pc] += fac*NCells[MaxProcs()*Level+pc];
00333 }
00334 WholeCells += WCells[pc];
00335 WholeWork += Work[pc];
00336 if (Work[pc] != 0)
00337 if (pc > NProcs) NProcs = pc;
00338 }
00339 for (pc=0; pc<MaxProcs(); pc++)
00340 if (WCells[pc] != 0)
00341 std::cerr << "Processor " << pc << ": " << WCells[pc]
00342 << " Cells, Load: "
00343 << float(Work[pc]) / (float(WholeWork) / float(NProcs+1))
00344 << std::endl;
00345 std::cerr << "On all Procs: " << WholeCells << " Cells" << std::endl;
00346 delete [] NCells;
00347 delete [] WCells;
00348 delete [] Work;
00349
00350 if (initialize) {
00351 if (_MinLevel < 0)
00352 _MinLevel = 0;
00353 if (_MinLevel >= HS->NLevels())
00354 _MinLevel = HS->NLevels()-1;
00355 if (_MaxLevel < 0)
00356 _MaxLevel = 0;
00357 if (_MaxLevel >= HS->NLevels())
00358 _MaxLevel = HS->NLevels()-1;
00359 }
00360
00361 typename block_list_type::iterator bit=BlockList().begin();
00362 for (Level=MaxLevel(); Level>=MinLevel(); Level--) {
00363 int sh[3];
00364 int d;
00365 for (d=0; d<3; d++) {
00366 sh[d] = show_shape[2*d+1];
00367 if (sh[d]>show_shape[2*d]) sh[d] -= 1;
00368 }
00369 globalbb = BBox(3,show_shape[0],show_shape[2],show_shape[4],
00370 sh[0],sh[1],sh[2],1);
00371
00372 for (d=0; d<3; d++) {
00373 int maxrf=1;
00374 for (int ii=(show_exact[d] ? Level : 0); ii<NLevels()-1; ii++)
00375 maxrf *= _RefineFactor[ii];
00376 globalbb.coarsen(d,maxrf);
00377 globalbb.refine(d,maxrf,0);
00378 }
00379
00380 int cnt = 0;
00381 int cells = 0;
00382 for (hblock_list_iterator hsbit=HS->BlockList(Level).begin();
00383 hsbit!=HS->BlockList(Level).end(); hsbit++, cnt++) {
00384 if (initialize) {
00385 cells += (*hsbit).first->bbox().size();
00386 BBox bb((*hsbit).first->bbox());
00387 bb *= globalbb;
00388 bb.lower() = (bb.lower()/bb.stepsize())*bb.stepsize();
00389 bb.upper() = (bb.upper()/bb.stepsize())*bb.stepsize();
00390 BBoxList bbl;
00391 bbl.add(bb);
00392 if (_CutOut) {
00393 BBoxList bblall;
00394 for (typename block_list_type::iterator bitall=BlockList().begin();
00395 bitall!=BlockList().end(); bitall++)
00396 bblall.add(coarsen((**bitall).DB().bbox(),
00397 (*hsbit).first->bbox().stepsize()/
00398 (**bitall).DB().bbox().stepsize()));
00399 bbl -= bblall;
00400 }
00401 if (!bbl.isempty())
00402 for (BBox* bbp = bbl.first(); bbp; bbp=bbl.next())
00403 if (!bbp->empty()) {
00404 if (InitWholeVector)
00405 BlockListAppend(*((*hsbit).first), *bbp, -1, Level, (*hsbit).second, dx, geom);
00406 else
00407 BlockListAppend(*((*hsbit).first), *bbp, i, Level, (*hsbit).second, dx, geom);
00408 }
00409 }
00410 else {
00411 if (!InitWholeVector) {
00412 if (bit!=BlockList().end()) {
00413 bool inside;
00414 do {
00415 BBox bb = (*hsbit).first->bbox()*(**bit).DB().bbox();
00416 if (!bb.empty() &&
00417 bb.stepsize()==(**bit).DB().bbox().stepsize()) {
00418 BeginFastIndex3(source, (*hsbit).first->bbox(), (*hsbit).first->data(),
00419 DataType);
00420 BeginFastIndex3(target, (**bit).DB().bbox(),
00421 (**bit).DB().data(), VectorType);
00422 for_3 (n, m, l, bb, bb.stepsize())
00423 FastIndex3(target,n,m,l)(i) = FastIndex3(source,n,m,l);
00424 end_for
00425 EndFastIndex3(source);
00426 EndFastIndex3(target);
00427 inside=true;
00428 bit++;
00429 }
00430 else inside=false;
00431 } while (inside && bit!=BlockList().end());
00432 }
00433 }
00434 else {
00435 for (typename block_list_type::iterator bitall=BlockList().begin();
00436 bitall!=BlockList().end(); bitall++) {
00437 BBox bb = (*hsbit).first->bbox()*(**bitall).DB().bbox();
00438 if (!bb.empty() &&
00439 bb.stepsize()==(**bitall).DB().bbox().stepsize()) {
00440 BeginFastIndex3(source, (*hsbit).first->bbox(), (*hsbit).first->data(),
00441 DataType);
00442 BeginFastIndex3(target, (**bitall).DB().bbox(),
00443 (**bitall).DB().data(), VectorType);
00444 for_3 (n, m, l, bb, bb.stepsize())
00445 FastIndex3(target,n,m,l)(i) = FastIndex3(source,n,m,l);
00446 end_for
00447 EndFastIndex3(source);
00448 EndFastIndex3(target);
00449 }
00450 }
00451 }
00452 }
00453 }
00454 if (initialize)
00455 std::cerr << "On Level " << Level << ": " << cnt << " Grids with "
00456 << cells << " Cells read in." << std::endl;
00457 }
00458
00459 initialize = false;
00460 delete HS;
00461 }
00462
00463 if (initialize)
00464 return -1;
00465
00466 for (i=0; i<VectorLength; i++) {
00467 if (CompName[i].c_str()[0] == '-') {
00468 std::cerr << "Setting Component " << i << " to zero." << std::endl;
00469 for (typename block_list_type::iterator bit=BlockList().begin();
00470 bit!=BlockList().end(); bit++) {
00471 BeginFastIndex3(target, (**bit).DB().bbox(),
00472 (**bit).DB().data(), VectorType);
00473 for_3 (n, m, l, (**bit).DB().bbox(), (**bit).DB().bbox().stepsize())
00474 FastIndex3(target,n,m,l)(i) = DataType(0.0);
00475 end_for
00476 EndFastIndex3(target);
00477 }
00478 }
00479 }
00480 return 0;
00481 }
00482
00483 void OutputFileTime(char *time, const int& Time) {
00484 if (StepFormat<=0)
00485 std::sprintf(time,"%d",Time);
00486 else if (StepFormat==1) {
00487 if (Time<=999999)
00488 std::sprintf(time,"%6.6d",Time);
00489 else if (Time<=99999999)
00490 std::sprintf(time,"%8.8d",Time);
00491 else
00492 std::sprintf(time,"%d",Time);
00493 }
00494 }
00495
00496 void OutputFileName(char *ioname, const char* name, const int& Time) {
00497 char time[20], help[DAGHBktGFNameWidth+256];
00498 OutputFileTime(time,Time);
00499 if (CompDir.c_str()[0] != '-' && CompDir.length()>0)
00500 std::sprintf(ioname,"%s/",CompDir.c_str());
00501 else
00502 ioname[0]='\0';
00503 if (StepDirectories>0) {
00504 std::sprintf(help,"%s/",time);
00505 strcat(ioname,help);
00506 }
00507 std::sprintf(help,"%s_%s",name,time);
00508 strcat(ioname,help);
00509 }
00510
00511 virtual int NCells() {
00512 int cells=0;
00513 for (typename block_list_type::iterator bit=BlockList().begin();
00514 bit!=BlockList().end(); bit++)
00515 cells += (*bit)->NCells();
00516 return cells;
00517 }
00518 virtual int NNodes() {
00519 int nodes=0;
00520 for (typename block_list_type::iterator bit=BlockList().begin();
00521 bit!=BlockList().end(); bit++)
00522 nodes += (*bit)->NNodes();
00523 return nodes;
00524 }
00525
00526 virtual void SetBlocks(int blocks[]) {
00527 int offset=0; int noffset=0;
00528 for (typename block_list_type::iterator bit=BlockList().begin();
00529 bit!=BlockList().end(); bit++)
00530 (*bit)->SetBlocks(blocks,offset,noffset);
00531 }
00532
00533 virtual void SetGridCells(float xyz[][3]) {
00534 int offset=0;
00535 std::cerr << "SetGridCells()";
00536 for (typename block_list_type::iterator bit=BlockList().begin();
00537 bit!=BlockList().end(); bit++)
00538 (*bit)->SetGridCells(xyz,offset);
00539 std::cerr << std::endl;
00540 }
00541 virtual void SetGridNodes(float xyz[][3]) {
00542 int offset=0;
00543 std::cerr << "SetGridNodes()";
00544 for (typename block_list_type::iterator bit=BlockList().begin();
00545 bit!=BlockList().end(); bit++)
00546 (*bit)->SetGridNodes(xyz,offset);
00547 std::cerr << std::endl;
00548 }
00549
00550 virtual void SetGridConns(int con[][8]) {
00551 int offset=0;
00552 std::cerr << "SetGridConns()";
00553 for (typename block_list_type::iterator bit=BlockList().begin();
00554 bit!=BlockList().end(); bit++)
00555 (*bit)->SetGridConns(con,offset);
00556 std::cerr << std::endl;
00557 }
00558
00559 virtual void SetScalCells(int *key,float v[]) {
00560 int offset=0;
00561 std::cerr << "SetScalCells()";
00562 for (typename block_list_type::iterator bit=BlockList().begin();
00563 bit!=BlockList().end(); bit++)
00564 (*bit)->SetScalCells(key,v,offset,CompRead);
00565 std::cerr << std::endl;
00566 }
00567 virtual void SetScalNodes(int *key,float v[]) {
00568 int offset=0;
00569 std::cerr << "SetScalNodes()";
00570 for (typename block_list_type::iterator bit=BlockList().begin();
00571 bit!=BlockList().end(); bit++)
00572 (*bit)->SetScalNodes(key,v,offset,CompRead);
00573 std::cerr << std::endl;
00574 }
00575
00576 virtual void SetPointsCells(int *key,point_list_type &p,float v[]) {
00577 std::cerr << "SetPointsCells()";
00578 point_list_type p_tmp(p);
00579 for (register unsigned int i=0;i<p.size()/3;i++) v[i]=-1.e37;
00580 for (typename block_list_type::iterator bit=BlockList().begin();
00581 bit!=BlockList().end(); bit++)
00582 (*bit)->SetPointsCells(key,p_tmp,v,CompRead);
00583 std::cerr << std::endl;
00584 }
00585 virtual void SetPointsNodes(int *key,point_list_type &p,float v[]) {
00586 std::cerr << "SetPointsNodes()";
00587 point_list_type p_tmp(p);
00588 for (register unsigned int i=0;i<p.size()/3;i++) v[i]=-1.e37;
00589 for (typename block_list_type::iterator bit=BlockList().begin();
00590 bit!=BlockList().end(); bit++)
00591 (*bit)->SetPointsNodes(key,p_tmp,v,CompRead);
00592 std::cerr << std::endl;
00593 }
00594
00595 virtual void VectNodes(int *key,float v[][3]) {
00596 int offset=0;
00597 std::cerr << "VectNodes()";
00598 for (typename block_list_type::iterator bit=BlockList().begin();
00599 bit!=BlockList().end(); bit++)
00600 (*bit)->VectNodes(key,v,offset,CompRead);
00601 std::cerr << std::endl;
00602 }
00603 virtual void VectCells(int *key,float v[][3]) {
00604 int offset=0;
00605 std::cerr << "VectCells()";
00606 for (typename block_list_type::iterator bit=BlockList().begin();
00607 bit!=BlockList().end(); bit++)
00608 (*bit)->VectCells(key,v,offset,CompRead);
00609 std::cerr << std::endl;
00610 }
00611
00612 virtual int Size() const { return BlockList().size(); }
00613 virtual const int& MinLevel() const { return _MinLevel; }
00614 virtual const int& MaxLevel() const { return _MaxLevel; }
00615 virtual const int& NLevels() const { return _NLevels; }
00616 virtual const int& MaxProcs() const { return _MaxProcs; }
00617 virtual const int& RefineFactor(const int l) const
00618 { return _RefineFactor[l]; }
00619 virtual const BBox& GlobalBBox() const { return globalbb; }
00620 virtual const int& FKeys() const { return _FKeys; }
00621
00622 virtual evaluator_type& TheEvaluator() const
00623 { return (evaluator_type &) vgridbase_type::TheEvaluator(); }
00624 virtual evaluator_type& TheEvaluator()
00625 { return (evaluator_type &) vgridbase_type::TheEvaluator(); }
00626
00627 block_list_type& BlockList() { return *_BlockList; }
00628 block_list_type& BlockList() const { return *_BlockList; }
00629
00630 const Coords Dimensions() const { return ( Make3d ? Coords(3,1): DimUsed) ; }
00631
00632 protected:
00633 block_list_type* _BlockList;
00634 int _FKeys;
00635 int _MinLevel;
00636 int _MaxLevel;
00637 int _NLevels;
00638 int _MaxProcs;
00639 int _RefineFactor[DAGHMaxLevels];
00640 int* PlotLevel;
00641 int shape[3];
00642 BBox globalbb;
00643 float geom[2*3];
00644 float show[2*3];
00645 float cut[3];
00646 int show_shape[2*3];
00647 int show_exact[3];
00648 float dx[3];
00649 public:
00650 Coords DimUsed;
00651 bool Make3d, InitWholeVector;
00652 int RestrictData;
00653 protected:
00654 int VectorLength;
00655 std::string* CompName;
00656 std::string CompDir;
00657 int StepFormat, StepDirectories, NoTimeRefine;
00658 bool* CompRead;
00659 int Symmetry[3];
00660 int Periodic[3];
00661 int _CutOut;
00662 int _Eliminate;
00663 DataType _EliminateValue;
00664 int _parData;
00665 BBox *_where, *_to, *_from;
00666 };
00667
00668 #endif