278 std::ostream* StdOut = NULL;
279 std::ostream* ErrOut = NULL;
280 std::ostream* LogOut = NULL;
281 std::ofstream LogFile;
282 IRAD::Global::GlobalObj<std::string,Mesh::IndexType,IRAD::Profiler::ProfilerObj> global;
283 IRAD::Comm::CommunicatorObject comm(&argc,&argv);
284 unsigned int rank = comm.Rank();
285 unsigned int nproc = comm.Size();
291 global.Init(
"flotsam",rank);
292 global.SetDebugLevel(0);
293 global.FunctionEntry(
"main");
296 comline.Initialize();
297 int clerr = comline.ProcessOptions();
298 std::string sverb = comline.GetOption(
"verb");
299 bool debug = !comline.GetOption(
"debug").empty();
300 bool array_checking = !comline.GetOption(
"checking").empty();
302 IRAD::Comm::DataTypes IndexDT = (
sizeof(
Mesh::IndexType) ==
sizeof(
size_t) ?
303 IRAD::Comm::DTSIZET : IRAD::Comm::DTUINT);
304 if(!comline.GetOption(
"help").empty()){
306 *StdOut << comline.LongUsage() << std::endl;
314 *ErrOut << comline.ErrorReport() << std::endl
315 << std::endl << comline.ShortUsage() << std::endl;
323 if(sverb !=
".true."){
324 std::istringstream Istr(sverb);
329 if(rank == 0 && verblevel > 0)
330 std::cout <<
"Flotsam running on " << nproc <<
" processors." << std::endl;
331 std::ostringstream debugfilename;
332 debugfilename << comline.ProgramName() <<
".output." <<
rank;
333 LogFile.open(debugfilename.str().c_str());
334 global.SetDebugStream(LogFile);
337 if(verblevel > 1 && rank > 0)
341 global.SetDebugStream(std::cerr);
345 if(verblevel > 1 || debug){
346 global.SetDebugLevel(1);
348 if(debug && rank > 0)
350 std::vector<std::string> infiles = comline.GetArgs();
351 if(infiles.size()==0) {
353 *ErrOut <<
"flotsam::Error: No input specified." << std::endl
354 << std::endl << comline.ShortUsage() << std::endl;
364 std::string casename(infiles[0]);
365 std::string timestamp(infiles[1]);
366 std::string targname(infiles[2]);
371 unsigned int total_source_cells = 0;
372 unsigned int total_source_nodes = 0;
373 unsigned int total_target_cells = 0;
374 unsigned int total_target_nodes = 0;
375 unsigned int NSourceRegions = 0;
376 unsigned int NTargetRegions = 0;
377 unsigned int totalcells = 0;
382 std::vector<std::vector<std::pair<Mesh::IndexType,Mesh::IndexType> > > target_source_cells;
383 std::vector<std::vector<Mesh::IndexType> > source_cell_ids;
384 std::vector<std::vector<Mesh::IndexType> > target_cell_ids;
386 std::vector<Mesh::Connectivity> source_mesh;
387 std::vector<Mesh::Connectivity> target_mesh;
389 bool do_search =
true;
391 global.FunctionEntry(
"ReadFloGrid");
392 sourcegrid.ReadAllBlocks();
393 global.FunctionExit(
"ReadFloGrid");
397 NSourceRegions = sourcegrid.Blocks().size();
399 std::vector<std::vector<double> > source_cell_centers(NSourceRegions);
403 std::vector<Mesh::BSExtent<Mesh::IndexType> > source_extents(NSourceRegions);
407 source_mesh.resize(NSourceRegions);
413 std::vector<std::vector<GeoPrim::CBox> > source_boxes(NSourceRegions);
419 std::vector<FloGridBlock>::iterator source_block_iterator = sourcegrid.Blocks().begin();
420 std::vector<Mesh::BSExtent<Mesh::IndexType> >::iterator source_extent_iterator = source_extents.begin();
421 std::vector<Mesh::Connectivity>::iterator source_mesh_iterator = source_mesh.begin();
422 std::vector<std::vector<GeoPrim::CBox> >::iterator source_boxes_iterator = source_boxes.begin();
423 while( source_block_iterator != sourcegrid.Blocks().end())
428 source_block_iterator->MeshLayout();
433 std::vector<Mesh::IndexType> source_block_extent(6,0);
434 unsigned int isize = source_block_iterator->isize();
435 unsigned int jsize = source_block_iterator->jsize();
436 unsigned int ksize = source_block_iterator->ksize();
437 source_block_extent[0] = source_block_extent[2] = source_block_extent[4] = 1;
438 source_block_extent[1] = isize+1;
439 source_block_extent[3] = jsize+1;
440 source_block_extent[5] = ksize+1;
441 source_extent_iterator->Init(source_block_extent);
445 global.FunctionEntry(
"CreateUnsMesh");
446 source_extent_iterator->CreateUnstructuredMesh(*source_mesh_iterator);
447 source_mesh_iterator->Sync();
448 source_mesh_iterator->SyncSizes();
449 global.FunctionExit(
"CreateUnsMesh");
456 unsigned int nnodes = source_block_iterator->NNodes();
457 nc.
init(nnodes,&((source_block_iterator->Coords())[0]));
458 unsigned int source_region_index = source_block_iterator - sourcegrid.Blocks().begin();
460 global.FunctionEntry(
"Orient elements");
462 unsigned int number_of_elements = isize*jsize*ksize;
464 element_being_processed <= number_of_elements;
465 element_being_processed++)
468 Mesh::IndexType size_of_element = (*source_mesh_iterator)[index].size();
470 if(ge.Inverted((*source_mesh_iterator)[index],nc)){
472 ge.ReOrient((*source_mesh_iterator)[index]);
475 global.FunctionExit(
"Orient elements");
480 global.FunctionEntry(
"BoxProcessing");
483 source_boxes_iterator->resize(3);
484 Mesh::GetMeshBoxes(nc,*source_mesh_iterator,(*source_boxes_iterator)[0],(*source_boxes_iterator)[1],
485 (*source_boxes_iterator)[2]);
486 sourcebox.
merge((*source_boxes_iterator)[0]);
487 global.FunctionExit(
"BoxProcessing");
490 total_source_nodes += nnodes;
491 total_source_cells += isize*jsize*ksize;
493 source_boxes_iterator++;
494 source_mesh_iterator++;
495 source_extent_iterator++;
496 source_block_iterator++;
499 if(StdOut && verblevel > 0)
500 *StdOut <<
"Source grid has " << NSourceRegions <<
" regions, "
501 << total_source_nodes <<
" nodes, and " << total_source_cells
502 <<
" cells." << std::endl
503 <<
"With bounding box: " << sourcebox << std::endl;
511 NTargetRegions = targetgrid.BlockCount();
512 comm.BroadCast(NTargetRegions,0);
514 std::cout <<
"ntarget regions = " << NTargetRegions << std::endl;
515 int ntargregpproc = NTargetRegions/nproc;
516 int nleftovers = NTargetRegions%nproc;
517 int first = rank * ntargregpproc + 1;
518 int ntargreg = ntargregpproc;
519 if(rank < nleftovers){
526 std::cout <<
"First/N: " << first <<
"/" << ntargreg << std::endl;
528 global.FunctionEntry(
"ReadFloGrid");
530 targetgrid.ReadNBlocks(first,ntargreg);
531 global.FunctionExit(
"ReadFloGrid");
532 unsigned int TargetGridSize = NTargetRegions;
533 NTargetRegions = ntargreg;
535 std::vector<Mesh::BSExtent<Mesh::IndexType> > target_extents(NTargetRegions);
536 target_mesh.resize(NTargetRegions);
538 std::vector<std::vector<GeoPrim::CBox> > target_boxes(NTargetRegions);
540 std::vector<FloGridBlock>::iterator target_block_iterator = targetgrid.Blocks().begin();
541 std::vector<Mesh::BSExtent<Mesh::IndexType> >::iterator target_extent_iterator = target_extents.begin();
542 std::vector<Mesh::Connectivity>::iterator target_mesh_iterator = target_mesh.begin();
543 std::vector<std::vector<GeoPrim::CBox> >::iterator target_boxes_iterator = target_boxes.begin();
544 while( target_block_iterator != targetgrid.Blocks().end())
546 target_block_iterator->MeshLayout();
547 std::vector<Mesh::IndexType> target_block_extent(6,0);
548 unsigned int isize = target_block_iterator->isize();
549 unsigned int jsize = target_block_iterator->jsize();
550 unsigned int ksize = target_block_iterator->ksize();
551 target_block_extent[0] = target_block_extent[2] = target_block_extent[4] = 1;
552 target_block_extent[1] = isize+1;
553 target_block_extent[3] = jsize+1;
554 target_block_extent[5] = ksize+1;
555 target_extent_iterator->Init(target_block_extent);
556 global.FunctionEntry(
"CreateUnsMesh");
557 target_extent_iterator->CreateUnstructuredMesh(*target_mesh_iterator);
558 target_mesh_iterator->Sync();
559 target_mesh_iterator->SyncSizes();
560 global.FunctionExit(
"CreateUnsMesh");
561 target_boxes_iterator->resize(3);
563 unsigned int nnodes = target_block_iterator->NNodes();
564 total_target_nodes += nnodes;
565 total_target_cells += (isize*jsize*ksize);
566 nc.
init(nnodes,&((target_block_iterator->Coords())[0]));
567 global.FunctionEntry(
"Orient elements");
569 unsigned int number_of_elements = isize*jsize*ksize;
571 element_being_processed <= number_of_elements;
572 element_being_processed++)
575 Mesh::IndexType size_of_element = (*target_mesh_iterator)[index].size();
577 if(ge.Inverted((*target_mesh_iterator)[index],nc)){
579 ge.ReOrient((*target_mesh_iterator)[index]);
582 global.FunctionExit(
"Orient elements");
586 global.FunctionEntry(
"BoxProcessing");
587 Mesh::GetMeshBoxes(nc,*target_mesh_iterator,(*target_boxes_iterator)[0],(*target_boxes_iterator)[1],
588 (*target_boxes_iterator)[2]);
589 targetbox.
merge((*target_boxes_iterator)[0]);
590 global.FunctionExit(
"BoxProcessing");
591 target_boxes_iterator++;
592 target_mesh_iterator++;
593 target_extent_iterator++;
594 target_block_iterator++;
597 unsigned int totalnodes = 0;
598 unsigned int nregions = 0;
599 double minx, maxx, miny, maxy, minz, maxz;
602 comm.Reduce(NTargetRegions,nregions,IRAD::Comm::DTUINT,IRAD::Comm::SUMOP,0);
603 comm.Reduce(total_target_cells,totalcells,IRAD::Comm::DTUINT,IRAD::Comm::SUMOP,0);
604 comm.Reduce(total_target_nodes,totalnodes,IRAD::Comm::DTUINT,IRAD::Comm::SUMOP,0);
605 comm.Reduce(targetbox.
P1().
x(),minx,IRAD::Comm::DTDOUBLE,IRAD::Comm::MINOP,0);
606 comm.Reduce(targetbox.
P1().
y(),miny,IRAD::Comm::DTDOUBLE,IRAD::Comm::MINOP,0);
607 comm.Reduce(targetbox.
P1().
z(),minz,IRAD::Comm::DTDOUBLE,IRAD::Comm::MINOP,0);
608 comm.Reduce(targetbox.
P2().
x(),maxx,IRAD::Comm::DTDOUBLE,IRAD::Comm::MAXOP,0);
609 comm.Reduce(targetbox.
P2().
y(),maxy,IRAD::Comm::DTDOUBLE,IRAD::Comm::MAXOP,0);
610 comm.Reduce(targetbox.
P2().
z(),maxz,IRAD::Comm::DTDOUBLE,IRAD::Comm::MAXOP,0);
613 if(StdOut && verblevel > 0) {
615 *StdOut <<
"Target grid (" << rank <<
") has " << NTargetRegions <<
" regions, "
616 << total_target_nodes <<
" nodes, and " << total_target_cells
617 <<
" cells." << std::endl
618 <<
"With bounding box: " << targetbox << std::endl;
620 *StdOut <<
"Target grid has " << nregions <<
" regions, "
621 << totalnodes <<
" nodes, and " << totalcells
622 <<
" cells." << std::endl
623 <<
"With bounding box: " << domainbox << std::endl;
633 std::vector< std::vector<GeoPrim::CBox> > target_intersections(NTargetRegions);
636 Mesh::Connectivity::iterator target_connectivity_iterator = target_connectivity.begin();
637 std::vector< std::vector<GeoPrim::CBox> >::iterator target_intersections_iterator = target_intersections.begin();
638 target_boxes_iterator = target_boxes.begin();
639 unsigned int target_id = 0;
643 global.FunctionEntry(
"RegionIntersection");
644 while(target_boxes_iterator != target_boxes.end()){
646 source_boxes_iterator = source_boxes.begin();
647 unsigned int source_id = 0;
649 while(source_boxes_iterator != source_boxes.end()){
652 if(!intersection.
empty()){
654 target_connectivity_iterator->push_back(source_id);
655 target_intersections_iterator->push_back(intersection);
657 source_boxes_iterator++;
660 target_connectivity_iterator++;
661 target_boxes_iterator++;
662 target_intersections_iterator++;
664 global.FunctionExit(
"RegionIntersection");
667 global.FunctionEntry(
"FindIntersectionCells");
670 std::vector<Mesh::Connectivity> target_intersection_cells(NTargetRegions);
671 std::vector<std::vector<double> > target_region_cell_centers(NTargetRegions);
677 std::vector<std::vector<std::vector<std::pair<Mesh::IndexType,Mesh::IndexType> > > > target_source_matches(NTargetRegions);
678 target_source_cells.resize(NTargetRegions);
679 std::vector<Mesh::Connectivity>::iterator tint_cells_iterator = target_intersection_cells.begin();
680 std::vector<std::vector<std::vector<std::pair<Mesh::IndexType,Mesh::IndexType> > > >::iterator tsmit =
681 target_source_matches.begin();
682 target_connectivity_iterator = target_connectivity.begin();
683 target_boxes_iterator = target_boxes.begin();
684 target_block_iterator = targetgrid.Blocks().begin();
685 target_mesh_iterator = target_mesh.begin();
686 target_intersections_iterator = target_intersections.begin();
687 while(tint_cells_iterator != target_intersection_cells.end())
690 unsigned int target_region_index = tint_cells_iterator - target_intersection_cells.begin();
691 unsigned int nnodes = target_block_iterator->NNodes();
692 unsigned int ncells = target_block_iterator->NumCells();
697 tsmit->resize(ncells);
698 target_source_cells[target_region_index].resize(ncells);
700 std::vector<bool> cell_found(ncells,
false);
703 global.FunctionEntry(
"Centroids");
705 global.FunctionExit(
"Centroids");
706 tint_cells_iterator->Resize(target_intersections_iterator->size());
707 Mesh::Connectivity::iterator intersection_cells_iterator = tint_cells_iterator->begin();
708 std::vector<GeoPrim::CBox>::iterator intersections_iterator = target_intersections_iterator->begin();
709 std::vector<Mesh::IndexType>::iterator source_region_ids = target_connectivity_iterator->begin();
710 while(intersections_iterator != target_intersections_iterator->end())
714 Mesh::IndexType nsource_nodes = sourcegrid.Blocks()[source_region_index].NNodes();
715 Mesh::NodalCoordinates source_coords(nsource_nodes,&(sourcegrid.Blocks()[source_region_index].Coords()[0]));
717 double source_edgelen = (source_boxes[source_region_index][1].P2() - source_boxes[source_region_index][1].P1()).
norm();
719 std::vector<Mesh::IndexType> source_cells;
720 global.FunctionEntry(
"CollideMeshBox");
722 global.FunctionExit(
"CollideMeshBox");
723 std::vector<Mesh::IndexType> target_cells;
724 global.FunctionEntry(
"CollideMeshBox");
726 global.FunctionExit(
"CollideMeshBox");
728 if(source_cells.empty() || target_cells.empty()){
737 std::vector<Mesh::IndexType>::iterator ttccii = target_cells.begin();
739 while(ttccii != target_cells.end()){
740 int i = *ttccii++ - 1;
741 intersection_box.
merge(*intersections_iterator);
742 GeoPrim::CPoint p(&(target_region_cell_centers[target_region_index][3*i]));
747 std::vector<Mesh::IndexType> candidates;
748 GeoPrim::CBox little_box(source_boxes[source_region_index][1].around(p));
750 global.FunctionEntry(
"WeedOut");
751 std::vector<Mesh::IndexType>::iterator srccellit = source_cells.begin();
752 while(srccellit != source_cells.end()){
753 GeoPrim::CPoint p2(&(source_cell_centers[source_region_index][3*(*srccellit-1)]));
754 if((p2-p).
norm() <= source_edgelen)
755 candidates.push_back(*srccellit);
758 global.FunctionExit(
"WeedOut");
759 if(candidates.empty()){
760 global.FunctionEntry(
"CollideCellsBox");
762 global.FunctionExit(
"CollideCellsBox");
765 std::vector<Mesh::IndexType> candcopy(candidates);
766 candidates.resize(0);
767 global.FunctionEntry(
"CollideCellsBoxMini");
769 global.FunctionExit(
"CollideCellsBoxMini");
772 unsigned int source_cell_id = 0;
773 if(candidates.empty()){
778 global.FunctionEntry(
"FindPointInAllCells");
780 global.FunctionExit(
"FindPointInAllCells");
783 global.FunctionEntry(
"FindPointInCells");
785 global.FunctionExit(
"FindPointInCells");
787 if(source_cell_id > 0){
788 (*tsmit)[
i].push_back(std::make_pair(source_region_index+1,source_cell_id));
789 intersection_cells_iterator->push_back(i+1);
790 cell_found[
i] =
true;
798 unsigned int closest_cell = 0;
799 std::vector<Mesh::IndexType> *thecells;
800 if(candidates.empty())
801 thecells = &source_cells;
803 thecells = &candidates;
806 std::vector<Mesh::IndexType>::iterator ci = thecells->begin();
807 while(ci != thecells->end())
809 source_cell_id = *ci++;
811 if(dist.
mag() <
d.mag()){
813 closest_cell = source_cell_id;
818 (*tsmit)[
i].push_back(std::make_pair(source_region_index+1,closest_cell));
819 intersection_cells_iterator->push_back(i+1);
843 intersection_cells_iterator++;
844 intersections_iterator++;
854 if(!((*target_boxes_iterator)[0] == intersection_box) && StdOut)
855 *StdOut <<
"Mesh Box: " << (*target_boxes_iterator)[0]
856 <<
" Intersecting region: " << intersection_box << std::endl;
858 target_mesh_iterator++;
859 target_block_iterator++;
860 target_intersections_iterator++;
861 tint_cells_iterator++;
862 target_boxes_iterator++;
863 target_connectivity_iterator++;
866 global.FunctionExit(
"FindIntersectionCells");
870 std::cout << std::endl <<
"Preparing to write solution." << std::endl;
871 global.FunctionEntry(
"Reporting");
872 unsigned int number_not_found = 0;
873 bool reporting =
false;
874 tsmit = target_source_matches.begin();
875 while(tsmit != target_source_matches.end())
877 unsigned int target_region_index = tsmit - target_source_matches.begin();
878 std::vector<std::vector<std::pair<Mesh::IndexType,Mesh::IndexType> > >::iterator tci = tsmit->begin();
879 while(tci != tsmit->end()){
880 unsigned int target_cell_index = tci - tsmit->begin();
884 *StdOut <<
"(" << target_region_index+1 <<
"," << target_cell_index+1 <<
") not found." << std::endl;
888 *StdOut <<
"(" << target_region_index+1 <<
"," << target_cell_index+1 <<
") has "
889 << tci->size() <<
" matches." << std::endl
891 <<
GeoPrim::C3Point(&target_region_cell_centers[target_region_index][3*target_cell_index]) << std::endl
892 <<
"source(s): " << std::endl;
895 target_source_cells[target_region_index][target_cell_index] = (*tci)[0];
897 GeoPrim::CPoint p(&target_region_cell_centers[target_region_index][3*target_cell_index]);
898 std::vector<std::pair<Mesh::IndexType,Mesh::IndexType> >::iterator tcit = tci->begin();
900 std::pair<Mesh::IndexType,Mesh::IndexType> match;
901 while(tcit != tci->end()){
911 target_source_cells[target_region_index][target_cell_index] = match;
913 std::vector<std::pair<Mesh::IndexType,Mesh::IndexType> >::iterator tcit = tci->begin();
914 while(tcit != tci->end())
917 *StdOut <<
"(" << tcit->first <<
"," << tcit->second <<
") : ("
918 <<
GeoPrim::C3Point(&source_cell_centers[tcit->first-1][3*(tcit->second-1)])
920 <<
GeoPrim::C3Point(&source_cell_centers[tcit->first-1][3*(tcit->second-1)]) -
921 GeoPrim::C3Point(&target_region_cell_centers[target_region_index][3*target_cell_index])
932 if(number_not_found > 0 && StdOut)
933 *StdOut << number_not_found <<
"/" << total_target_cells <<
" cells not found or processed." << std::endl;
934 global.FunctionExit(
"Reporting");
942 global.FunctionEntry(
"SolutionRead");
944 if(sourcegrid.ReadAllSolutions(timestamp)){
945 std::cout <<
"Could not read source solutions." << std::endl;
948 global.FunctionExit(
"SolutionRead");
951 unsigned int ng = sourcegrid.Blocks()[0].NGhostLayers();
952 double unknown_number = sourcegrid.UnknownNumber();
953 double time = sourcegrid.Time();
954 targetgrid.SetGhostLayers(ng);
955 targetgrid.CreateSolutions();
956 std::vector<FloGridBlock> &targetgrids = targetgrid.Blocks();
959 source_cell_ids.resize(NSourceRegions);
960 std::vector<FloGridBlock> &sourcegrids = sourcegrid.Blocks();
961 std::vector<FloGridBlock>::iterator sbi = sourcegrids.begin();
962 while(sbi != sourcegrids.end()){
963 unsigned int source_grid_index = sbi - sourcegrids.begin();
966 std::vector<Mesh::IndexType> source_block_extent(6,0);
967 std::vector<Mesh::IndexType> source_ghost_extent(6,0);
968 unsigned int isize = sbi->isize();
969 unsigned int jsize = sbi->jsize();
970 unsigned int ksize = sbi->ksize();
971 source_block_extent[0] = source_block_extent[2] = source_block_extent[4] = 1 + ng;
972 source_ghost_extent[0] = source_ghost_extent[2] = source_ghost_extent[4] = 1;
973 source_block_extent[1] = isize+ng;
974 source_block_extent[3] = jsize+ng;
975 source_block_extent[5] = ksize+ng;
976 source_ghost_extent[1] = isize+(2*ng);
977 source_ghost_extent[3] = jsize+(2*ng);
978 source_ghost_extent[5] = ksize+(2*ng);
979 real_extent.
Init(source_block_extent);
980 ghost_extent.
Init(source_ghost_extent);
981 ghost_extent.
GetFlatIndices(real_extent,source_cell_ids[source_grid_index]);
986 global.FunctionEntry(
"DataTransfer");
987 target_cell_ids.resize(NTargetRegions);
988 std::vector<std::vector<std::pair<Mesh::IndexType,Mesh::IndexType> > >::iterator tsci = target_source_cells.begin();
989 while(tsci != target_source_cells.end()){
990 unsigned int target_region_index = tsci - target_source_cells.begin();
992 std::vector<Mesh::IndexType> &target_cell_ids_local = target_cell_ids[target_region_index];
995 std::vector<Mesh::IndexType> target_block_extent(6,0);
996 std::vector<Mesh::IndexType> target_ghost_extent(6,0);
997 unsigned int isize = targetgrids[target_region_index].isize();
998 unsigned int jsize = targetgrids[target_region_index].jsize();
999 unsigned int ksize = targetgrids[target_region_index].ksize();
1000 target_block_extent[0] = target_block_extent[2] = target_block_extent[4] = 1 + ng;
1001 target_ghost_extent[0] = target_ghost_extent[2] = target_ghost_extent[4] = 1;
1002 target_block_extent[1] = isize+ng;
1003 target_block_extent[3] = jsize+ng;
1004 target_block_extent[5] = ksize+ng;
1005 target_ghost_extent[1] = isize+(2*ng);
1006 target_ghost_extent[3] = jsize+(2*ng);
1007 target_ghost_extent[5] = ksize+(2*ng);
1008 real_extent.
Init(target_block_extent);
1009 ghost_extent.
Init(target_ghost_extent);
1012 unsigned int target_block = (isize+(2*ng))*(jsize+(2*ng))*(ksize+(2*ng));
1014 std::vector<std::pair<Mesh::IndexType,Mesh::IndexType> >::iterator tci = tsci->begin();
1015 while(tci != tsci->end()){
1016 unsigned int target_cell_index = target_cell_ids_local[tci - tsci->begin()] - 1;
1017 unsigned int source_region_index = tci->first - 1;
1018 unsigned int source_cell_index = source_cell_ids[source_region_index][tci->second -1] - 1;
1019 unsigned int source_block = (sourcegrids[source_region_index].isize()+(2*ng))*
1020 (sourcegrids[source_region_index].jsize()+(2*ng))*(sourcegrids[source_region_index].ksize()+(2*ng));
1022 targetgrids[target_region_index].Solution()[target_cell_index] =
1023 sourcegrids[source_region_index].Solution()[source_cell_index];
1025 targetgrids[target_region_index].Solution()[target_block+target_cell_index] =
1026 sourcegrids[source_region_index].Solution()[source_block+source_cell_index];
1028 targetgrids[target_region_index].Solution()[(2*target_block) + target_cell_index] =
1029 sourcegrids[source_region_index].Solution()[(2*source_block) + source_cell_index];
1031 targetgrids[target_region_index].Solution()[(3*target_block) + target_cell_index] =
1032 sourcegrids[source_region_index].Solution()[(3*source_block) + source_cell_index];
1034 targetgrids[target_region_index].Solution()[(4*target_block) + target_cell_index] =
1035 sourcegrids[source_region_index].Solution()[(4*source_block) + source_cell_index];
1041 global.FunctionExit(
"DataTransfer");
1042 global.FunctionEntry(
"GhostZoneFlood");
1043 std::vector<FloGridBlock>::iterator tgi = targetgrids.begin();
1044 while(tgi != targetgrids.end()){
1045 unsigned int target_grid_index = tgi - targetgrids.begin();
1047 std::vector<Mesh::IndexType> flat_full_extent(6,0);
1048 unsigned int isize = tgi->isize();
1049 unsigned int jsize = tgi->jsize();
1050 unsigned int ksize = tgi->ksize();
1051 flat_full_extent[0] = flat_full_extent[2] = flat_full_extent[4] = 1;
1052 flat_full_extent[1] = isize+(2*ng);
1053 flat_full_extent[3] = jsize+(2*ng);
1054 flat_full_extent[5] = ksize+(2*ng);
1055 full_extent.
Init(flat_full_extent);
1056 unsigned int target_block = (isize+(2*ng))*(jsize+(2*ng))*(ksize+(2*ng));
1057 bool do_iplane =
true;
1060 std::vector<Mesh::IndexType> flat_plane_extent(6,0);
1061 flat_plane_extent[0] = flat_plane_extent[1] = ng+1;
1062 flat_plane_extent[2] = flat_plane_extent[4] = ng+1;
1063 flat_plane_extent[3] = jsize + ng;
1064 flat_plane_extent[5] = ksize + ng;
1065 plane_extent.
Init(flat_plane_extent);
1066 std::vector<Mesh::IndexType> real_cell_ids;
1068 for(
int ii = 1;ii <= ng;ii++){
1069 std::vector<Mesh::IndexType> flat_ghost_layer(6,0);
1070 flat_ghost_layer[0] = flat_ghost_layer[1] = ii;
1071 flat_ghost_layer[2] = flat_plane_extent[2];
1072 flat_ghost_layer[3] = flat_plane_extent[3];
1073 flat_ghost_layer[4] = flat_plane_extent[4];
1074 flat_ghost_layer[5] = flat_plane_extent[5];
1076 std::vector<Mesh::IndexType> ghost_cell_ids;
1078 assert(ghost_cell_ids.size() == real_cell_ids.size());
1079 std::vector<Mesh::IndexType>::iterator rci = real_cell_ids.begin();
1080 std::vector<Mesh::IndexType>::iterator gci = ghost_cell_ids.begin();
1081 while(rci != real_cell_ids.end()){
1082 unsigned int real_cell_index = *rci++ - 1;
1083 unsigned int ghost_cell_index = *gci++ - 1;
1084 targetgrids[target_grid_index].Solution()[ghost_cell_index] =
1085 targetgrids[target_grid_index].Solution()[real_cell_index];
1086 targetgrids[target_grid_index].Solution()[target_block+ghost_cell_index] =
1087 targetgrids[target_grid_index].Solution()[target_block+real_cell_index];
1088 targetgrids[target_grid_index].Solution()[(2*target_block)+ghost_cell_index] =
1089 targetgrids[target_grid_index].Solution()[(2*target_block)+real_cell_index];
1090 targetgrids[target_grid_index].Solution()[(3*target_block)+ghost_cell_index] =
1091 targetgrids[target_grid_index].Solution()[(3*target_block)+real_cell_index];
1092 targetgrids[target_grid_index].Solution()[(4*target_block)+ghost_cell_index] =
1093 targetgrids[target_grid_index].Solution()[(4*target_block)+real_cell_index];
1099 std::vector<Mesh::IndexType> flat_plane_extent(6,0);
1100 flat_plane_extent[0] = flat_plane_extent[1] = isize+ng;
1101 flat_plane_extent[2] = flat_plane_extent[4] = ng+1;
1102 flat_plane_extent[3] = jsize + ng;
1103 flat_plane_extent[5] = ksize + ng;
1104 plane_extent.
Init(flat_plane_extent);
1105 std::vector<Mesh::IndexType> real_cell_ids;
1107 for(
int ii = 1;ii <= ng;ii++){
1108 std::vector<Mesh::IndexType> flat_ghost_layer(6,0);
1109 flat_ghost_layer[0] = flat_ghost_layer[1] = isize+ng+ii;
1110 flat_ghost_layer[2] = flat_plane_extent[2];
1111 flat_ghost_layer[3] = flat_plane_extent[3];
1112 flat_ghost_layer[4] = flat_plane_extent[4];
1113 flat_ghost_layer[5] = flat_plane_extent[5];
1115 std::vector<Mesh::IndexType> ghost_cell_ids;
1117 std::vector<Mesh::IndexType>::iterator rci = real_cell_ids.begin();
1118 std::vector<Mesh::IndexType>::iterator gci = ghost_cell_ids.begin();
1119 assert(ghost_cell_ids.size() == real_cell_ids.size());
1120 while(rci != real_cell_ids.end()){
1121 unsigned int real_cell_index = *rci++ - 1;
1122 unsigned int ghost_cell_index = *gci++ - 1;
1123 targetgrids[target_grid_index].Solution()[ghost_cell_index] =
1124 targetgrids[target_grid_index].Solution()[real_cell_index];
1125 targetgrids[target_grid_index].Solution()[target_block+ghost_cell_index] =
1126 targetgrids[target_grid_index].Solution()[target_block+real_cell_index];
1127 targetgrids[target_grid_index].Solution()[(2*target_block)+ghost_cell_index] =
1128 targetgrids[target_grid_index].Solution()[(2*target_block)+real_cell_index];
1129 targetgrids[target_grid_index].Solution()[(3*target_block)+ghost_cell_index] =
1130 targetgrids[target_grid_index].Solution()[(3*target_block)+real_cell_index];
1131 targetgrids[target_grid_index].Solution()[(4*target_block)+ghost_cell_index] =
1132 targetgrids[target_grid_index].Solution()[(4*target_block)+real_cell_index];
1138 bool do_jplane =
true;
1141 std::vector<Mesh::IndexType> flat_plane_extent(6,0);
1142 flat_plane_extent[0] = 1;
1143 flat_plane_extent[1] = isize+(2*ng);
1144 flat_plane_extent[2] = flat_plane_extent[3] = ng+1;
1145 flat_plane_extent[4] = ng+1;
1146 flat_plane_extent[5] = ksize + ng;
1147 plane_extent.
Init(flat_plane_extent);
1148 std::vector<Mesh::IndexType> real_cell_ids;
1150 for(
int ii = 1;ii <= ng;ii++){
1151 std::vector<Mesh::IndexType> flat_ghost_layer(6,0);
1152 flat_ghost_layer[0] = flat_plane_extent[0];
1153 flat_ghost_layer[1] = flat_plane_extent[1];
1154 flat_ghost_layer[2] = flat_ghost_layer[3] = ii;
1155 flat_ghost_layer[4] = flat_plane_extent[4];
1156 flat_ghost_layer[5] = flat_plane_extent[5];
1158 std::vector<Mesh::IndexType> ghost_cell_ids;
1160 std::vector<Mesh::IndexType>::iterator rci = real_cell_ids.begin();
1161 std::vector<Mesh::IndexType>::iterator gci = ghost_cell_ids.begin();
1162 assert(ghost_cell_ids.size() == real_cell_ids.size());
1163 while(rci != real_cell_ids.end()){
1164 unsigned int real_cell_index = *rci++ - 1;
1165 unsigned int ghost_cell_index = *gci++ - 1;
1166 targetgrids[target_grid_index].Solution()[ghost_cell_index] =
1167 targetgrids[target_grid_index].Solution()[real_cell_index];
1168 targetgrids[target_grid_index].Solution()[target_block+ghost_cell_index] =
1169 targetgrids[target_grid_index].Solution()[target_block+real_cell_index];
1170 targetgrids[target_grid_index].Solution()[(2*target_block)+ghost_cell_index] =
1171 targetgrids[target_grid_index].Solution()[(2*target_block)+real_cell_index];
1172 targetgrids[target_grid_index].Solution()[(3*target_block)+ghost_cell_index] =
1173 targetgrids[target_grid_index].Solution()[(3*target_block)+real_cell_index];
1174 targetgrids[target_grid_index].Solution()[(4*target_block)+ghost_cell_index] =
1175 targetgrids[target_grid_index].Solution()[(4*target_block)+real_cell_index];
1183 std::vector<Mesh::IndexType> flat_plane_extent(6,0);
1184 flat_plane_extent[0] = 1;
1185 flat_plane_extent[1] = isize+(2*ng);
1186 flat_plane_extent[2] = flat_plane_extent[3] = jsize+ng;
1187 flat_plane_extent[4] = ng+1;
1188 flat_plane_extent[5] = ksize + ng;
1189 plane_extent.
Init(flat_plane_extent);
1190 std::vector<Mesh::IndexType> real_cell_ids;
1192 for(
int ii = 1;ii <= ng;ii++){
1193 std::vector<Mesh::IndexType> flat_ghost_layer(6,0);
1194 flat_ghost_layer[0] = flat_plane_extent[0];
1195 flat_ghost_layer[1] = flat_plane_extent[1];
1196 flat_ghost_layer[2] = flat_ghost_layer[3] = ii+jsize+ng;
1197 flat_ghost_layer[4] = flat_plane_extent[4];
1198 flat_ghost_layer[5] = flat_plane_extent[5];
1200 std::vector<Mesh::IndexType> ghost_cell_ids;
1202 std::vector<Mesh::IndexType>::iterator rci = real_cell_ids.begin();
1203 std::vector<Mesh::IndexType>::iterator gci = ghost_cell_ids.begin();
1204 assert(ghost_cell_ids.size() == real_cell_ids.size());
1205 while(rci != real_cell_ids.end()){
1206 unsigned int real_cell_index = *rci++ - 1;
1207 unsigned int ghost_cell_index = *gci++ - 1;
1208 targetgrids[target_grid_index].Solution()[ghost_cell_index] =
1209 targetgrids[target_grid_index].Solution()[real_cell_index];
1210 targetgrids[target_grid_index].Solution()[target_block+ghost_cell_index] =
1211 targetgrids[target_grid_index].Solution()[target_block+real_cell_index];
1212 targetgrids[target_grid_index].Solution()[(2*target_block)+ghost_cell_index] =
1213 targetgrids[target_grid_index].Solution()[(2*target_block)+real_cell_index];
1214 targetgrids[target_grid_index].Solution()[(3*target_block)+ghost_cell_index] =
1215 targetgrids[target_grid_index].Solution()[(3*target_block)+real_cell_index];
1216 targetgrids[target_grid_index].Solution()[(4*target_block)+ghost_cell_index] =
1217 targetgrids[target_grid_index].Solution()[(4*target_block)+real_cell_index];
1223 bool do_kplane =
true;
1226 std::vector<Mesh::IndexType> flat_plane_extent(6,0);
1227 flat_plane_extent[0] = 1;
1228 flat_plane_extent[1] = isize+(2*ng);
1229 flat_plane_extent[2] = 1;
1230 flat_plane_extent[3] = jsize+(2*ng);
1231 flat_plane_extent[4] = flat_plane_extent[5] = ng+1;
1232 plane_extent.
Init(flat_plane_extent);
1233 std::vector<Mesh::IndexType> real_cell_ids;
1235 for(
int ii = 1;ii <= ng;ii++){
1236 std::vector<Mesh::IndexType> flat_ghost_layer(6,0);
1237 flat_ghost_layer[0] = flat_plane_extent[0];
1238 flat_ghost_layer[1] = flat_plane_extent[1];
1239 flat_ghost_layer[2] = flat_plane_extent[2];
1240 flat_ghost_layer[3] = flat_plane_extent[3];
1241 flat_ghost_layer[4] = flat_ghost_layer[5] = ii;
1243 std::vector<Mesh::IndexType> ghost_cell_ids;
1245 std::vector<Mesh::IndexType>::iterator rci = real_cell_ids.begin();
1246 std::vector<Mesh::IndexType>::iterator gci = ghost_cell_ids.begin();
1247 assert(ghost_cell_ids.size() == real_cell_ids.size());
1248 while(rci != real_cell_ids.end()){
1249 unsigned int real_cell_index = *rci++ - 1;
1250 unsigned int ghost_cell_index = *gci++ - 1;
1251 targetgrids[target_grid_index].Solution()[ghost_cell_index] =
1252 targetgrids[target_grid_index].Solution()[real_cell_index];
1253 targetgrids[target_grid_index].Solution()[target_block+ghost_cell_index] =
1254 targetgrids[target_grid_index].Solution()[target_block+real_cell_index];
1255 targetgrids[target_grid_index].Solution()[(2*target_block)+ghost_cell_index] =
1256 targetgrids[target_grid_index].Solution()[(2*target_block)+real_cell_index];
1257 targetgrids[target_grid_index].Solution()[(3*target_block)+ghost_cell_index] =
1258 targetgrids[target_grid_index].Solution()[(3*target_block)+real_cell_index];
1259 targetgrids[target_grid_index].Solution()[(4*target_block)+ghost_cell_index] =
1260 targetgrids[target_grid_index].Solution()[(4*target_block)+real_cell_index];
1268 std::vector<Mesh::IndexType> flat_plane_extent(6,0);
1269 flat_plane_extent[0] = 1;
1270 flat_plane_extent[1] = isize+(2*ng);
1271 flat_plane_extent[2] = 1;
1272 flat_plane_extent[3] = jsize+(2*ng);
1273 flat_plane_extent[4] = flat_plane_extent[5] = ng+ksize;
1274 plane_extent.
Init(flat_plane_extent);
1275 std::vector<Mesh::IndexType> real_cell_ids;
1277 for(
int ii = 1;ii <= ng;ii++){
1278 std::vector<Mesh::IndexType> flat_ghost_layer(6,0);
1279 flat_ghost_layer[0] = flat_plane_extent[0];
1280 flat_ghost_layer[1] = flat_plane_extent[1];
1281 flat_ghost_layer[2] = flat_plane_extent[2];
1282 flat_ghost_layer[3] = flat_plane_extent[3];
1283 flat_ghost_layer[4] = flat_ghost_layer[5] = ii+ng+ksize;
1285 std::vector<Mesh::IndexType> ghost_cell_ids;
1287 std::vector<Mesh::IndexType>::iterator rci = real_cell_ids.begin();
1288 std::vector<Mesh::IndexType>::iterator gci = ghost_cell_ids.begin();
1289 assert(ghost_cell_ids.size() == real_cell_ids.size());
1290 while(rci != real_cell_ids.end()){
1291 unsigned int real_cell_index = *rci++ - 1;
1292 unsigned int ghost_cell_index = *gci++ - 1;
1293 targetgrids[target_grid_index].Solution()[ghost_cell_index] =
1294 targetgrids[target_grid_index].Solution()[real_cell_index];
1295 targetgrids[target_grid_index].Solution()[target_block+ghost_cell_index] =
1296 targetgrids[target_grid_index].Solution()[target_block+real_cell_index];
1297 targetgrids[target_grid_index].Solution()[(2*target_block)+ghost_cell_index] =
1298 targetgrids[target_grid_index].Solution()[(2*target_block)+real_cell_index];
1299 targetgrids[target_grid_index].Solution()[(3*target_block)+ghost_cell_index] =
1300 targetgrids[target_grid_index].Solution()[(3*target_block)+real_cell_index];
1301 targetgrids[target_grid_index].Solution()[(4*target_block)+ghost_cell_index] =
1302 targetgrids[target_grid_index].Solution()[(4*target_block)+real_cell_index];
1311 global.FunctionExit(
"GhostZoneFlood");
1313 unsigned int ncells = 0;
1317 std::vector<double> sourcemean(5,0);
1318 std::vector<std::vector<Mesh::IndexType> >::iterator sri = source_cell_ids.begin();
1319 while(sri != source_cell_ids.end()){
1320 unsigned int source_region_index = sri - source_cell_ids.begin();
1321 std::vector<Mesh::IndexType>::iterator sci = sri->begin();
1322 unsigned int blocksize = (sourcegrids[source_region_index].isize()+(2*ng)) *
1323 (sourcegrids[source_region_index].jsize()+(2*ng)) * (sourcegrids[source_region_index].ksize()+(2*ng));
1324 while(sci != sri->end()){
1326 unsigned int source_cell_index = *sci++-1;
1328 double val = sourcegrids[source_region_index].Solution()[source_cell_index];
1329 sourcemean[0] += val;
1330 if(val > sourcemax[0])
1332 if(val < sourcemin[0])
1335 val = sourcegrids[source_region_index].Solution()[blocksize+source_cell_index];
1336 sourcemean[1] += val;
1337 if(val > sourcemax[1])
1339 if(val < sourcemin[1])
1342 val = sourcegrids[source_region_index].Solution()[(2*blocksize)+source_cell_index];
1343 sourcemean[2] += val;
1344 if(val > sourcemax[2])
1346 if(val < sourcemin[2])
1349 val = sourcegrids[source_region_index].Solution()[(3*blocksize)+source_cell_index];
1350 sourcemean[3] += val;
1351 if(val > sourcemax[3])
1353 if(val < sourcemin[3])
1356 val = sourcegrids[source_region_index].Solution()[(4*blocksize)+source_cell_index];
1357 sourcemean[4] += val;
1358 if(val > sourcemax[4])
1360 if(val < sourcemin[4])
1366 if(ncells != total_source_cells)
1367 std::cout <<
"Warning: Source soln extents indicate only " << ncells
1368 <<
"/" << total_source_cells <<
" real cells." << std::endl;
1369 double scale = 1.0/
static_cast<double>(ncells);
1370 sourcemean[0] *= scale;
1371 sourcemean[1] *= scale;
1372 sourcemean[2] *= scale;
1373 sourcemean[3] *= scale;
1374 sourcemean[4] *= scale;
1375 std::cout <<
"Source Data (min,max,mean):" << std::endl
1376 <<
"rho : (" << sourcemin[0] <<
"," << sourcemax[0]
1377 <<
"," << sourcemean[0] <<
")" << std::endl
1378 <<
"rho-u: (" << sourcemin[1] <<
"," << sourcemax[1]
1379 <<
"," << sourcemean[1] <<
")" << std::endl
1380 <<
"rho-v: (" << sourcemin[2] <<
"," << sourcemax[2]
1381 <<
"," << sourcemean[2] <<
")" << std::endl
1382 <<
"rho-w: (" << sourcemin[3] <<
"," << sourcemax[3]
1383 <<
"," << sourcemean[3] <<
")" << std::endl
1384 <<
"rho-E: (" << sourcemin[4] <<
"," << sourcemax[4]
1385 <<
"," << sourcemean[4] <<
")" << std::endl;
1391 std::vector<double> targetmean(5,0);
1392 std::vector<double> ttargetmean(5,0);
1394 std::vector<std::vector<Mesh::IndexType> >::iterator sri = target_cell_ids.begin();
1395 while(sri != target_cell_ids.end()){
1396 unsigned int target_region_index = sri - target_cell_ids.begin();
1397 std::vector<Mesh::IndexType>::iterator sci = sri->begin();
1398 unsigned int blocksize = (targetgrids[target_region_index].isize()+(2*ng)) *
1399 (targetgrids[target_region_index].jsize()+(2*ng))*(targetgrids[target_region_index].ksize()+(2*ng));
1400 while(sci != sri->end()){
1402 unsigned int target_cell_index = *sci++-1;
1403 double val = targetgrids[target_region_index].Solution()[target_cell_index];
1404 targetmean[0] += val;
1405 if(val > targetmax[0])
1407 if(val < targetmin[0])
1409 val = targetgrids[target_region_index].Solution()[blocksize+ target_cell_index];
1410 targetmean[1] += val;
1411 if(val > targetmax[1])
1413 if(val < targetmin[1])
1415 val = targetgrids[target_region_index].Solution()[2*blocksize+target_cell_index];
1416 targetmean[2] += val;
1417 if(val > targetmax[2])
1419 if(val < targetmin[2])
1421 val = targetgrids[target_region_index].Solution()[3*blocksize+target_cell_index];
1422 targetmean[3] += val;
1423 if(val > targetmax[3])
1425 if(val < targetmin[3])
1427 val = targetgrids[target_region_index].Solution()[4*blocksize +target_cell_index];
1428 targetmean[4] += val;
1429 if(val > targetmax[4])
1431 if(val < targetmin[4])
1437 if(ncells != total_target_cells)
1438 std::cout <<
"Warning: Target soln extents indicate only " << ncells
1439 <<
"/" << total_target_cells <<
" real cells." << std::endl;
1441 comm.Reduce(targetmean,ttargetmean,IRAD::Comm::DTDOUBLE,IRAD::Comm::SUMOP,0);
1442 comm.Reduce(targetmin,ttargetmin,IRAD::Comm::DTDOUBLE,IRAD::Comm::MINOP,0);
1443 comm.Reduce(targetmax,ttargetmax,IRAD::Comm::DTDOUBLE,IRAD::Comm::MAXOP,0);
1444 double scale = 1.0/
static_cast<double>(ncells);
1445 targetmean[0] *= scale;
1446 targetmean[1] *= scale;
1447 targetmean[2] *= scale;
1448 targetmean[3] *= scale;
1449 targetmean[4] *= scale;
1450 scale = 1.0/
static_cast<double>(totalcells);
1451 ttargetmean[0] *= scale;
1452 ttargetmean[1] *= scale;
1453 ttargetmean[2] *= scale;
1454 ttargetmean[3] *= scale;
1455 ttargetmean[4] *= scale;
1456 if(verblevel > 0 && StdOut){
1457 if( (nproc==1) || ((rank > 0) && debug)){
1458 *StdOut <<
"Target Data (min,max,mean):" << std::endl
1459 <<
"rho : (" << targetmin[0] <<
"," << targetmax[0]
1460 <<
"," << targetmean[0] <<
")" << std::endl
1461 <<
"rho-u: (" << targetmin[1] <<
"," << targetmax[1]
1462 <<
"," << targetmean[1] <<
")" << std::endl
1463 <<
"rho-v: (" << targetmin[2] <<
"," << targetmax[2]
1464 <<
"," << targetmean[2] <<
")" << std::endl
1465 <<
"rho-w: (" << targetmin[3] <<
"," << targetmax[3]
1466 <<
"," << targetmean[3] <<
")" << std::endl
1467 <<
"rho-E: (" << targetmin[4] <<
"," << targetmax[4]
1468 <<
"," << targetmean[4] <<
")" << std::endl;
1472 *StdOut <<
"Target Data (min,max,mean):" << std::endl
1473 <<
"rho : (" << targetmin[0] <<
"," << targetmax[0]
1474 <<
"," << targetmean[0] <<
")" << std::endl
1475 <<
"rho-u: (" << targetmin[1] <<
"," << targetmax[1]
1476 <<
"," << targetmean[1] <<
")" << std::endl
1477 <<
"rho-v: (" << targetmin[2] <<
"," << targetmax[2]
1478 <<
"," << targetmean[2] <<
")" << std::endl
1479 <<
"rho-w: (" << targetmin[3] <<
"," << targetmax[3]
1480 <<
"," << targetmean[3] <<
")" << std::endl
1481 <<
"rho-E: (" << targetmin[4] <<
"," << targetmax[4]
1482 <<
"," << targetmean[4] <<
")" << std::endl;
1485 *StdOut <<
"Target Data (min,max,mean):" << std::endl
1486 <<
"rho : (" << ttargetmin[0] <<
"," << ttargetmax[0]
1487 <<
"," << ttargetmean[0] <<
")" << std::endl
1488 <<
"rho-u: (" << ttargetmin[1] <<
"," << ttargetmax[1]
1489 <<
"," << ttargetmean[1] <<
")" << std::endl
1490 <<
"rho-v: (" << ttargetmin[2] <<
"," << ttargetmax[2]
1491 <<
"," << ttargetmean[2] <<
")" << std::endl
1492 <<
"rho-w: (" << ttargetmin[3] <<
"," << ttargetmax[3]
1493 <<
"," << ttargetmean[3] <<
")" << std::endl
1494 <<
"rho-E: (" << ttargetmin[4] <<
"," << ttargetmax[4]
1495 <<
"," << ttargetmean[4] <<
")" << std::endl;
1500 global.FunctionEntry(
"SolutionWrite");
1502 targetgrid.OpenSolutionFile(timestamp,time,unknown_number);
1503 std::ostringstream Ostr;
1504 Ostr << std::scientific << std::setprecision(16);
1505 int datasize = targetgrid.WriteBlocks(Ostr);
1506 std::vector<int> datasizes(nproc,0);
1507 comm.Gather(datasize,datasizes);
1509 comm._Send(const_cast<char *>(Ostr.str().c_str()),datasize,0,0);
1511 std::ofstream &Ouf = targetgrid.SolnFile();
1512 targetgrid.WriteBlocks(Ouf);
1513 for(
unsigned int npi = 1;npi < nproc;npi++)
1515 std::vector<char> recvbuf(datasizes[npi]);
1516 comm._Recv(&recvbuf[0],datasizes[npi],npi,0);
1517 std::vector<char>::iterator rbi = recvbuf.begin();
1518 while(rbi != recvbuf.end())
1521 targetgrid.CloseSolutionFile();
1525 global.FunctionExit(
"SolutionWrite");
1564 global.FunctionExit(
"main");
1567 *LogOut <<
"All processors made it to the end." << std::endl;
1572 global.Report(*StdOut);
int GetMeshCentroids(Mesh::NodalCoordinates &nc, Mesh::Connectivity &conn, std::vector< double > ¢roids)
General connectivity object.
const CPoint & P2() const
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
CGAL_END_NAMESPACE CGAL_BEGIN_NAMESPACE Object intersection(const Line_2< R > &line1, const Line_2< R > &line2)
T norm(const NVec< DIM, T > &v)
void GetMeshBoxes(const NodalCoordinates &nc, const Connectivity &ec, GeoPrim::CBox &mesh_box, GeoPrim::CBox &small_box, GeoPrim::CBox &large_box)
Bounding boxes for a mesh.
void GetFlatIndices(const BSExtent< T > &extent, std::vector< T > &indices)
int CollideCellsWithBox(Mesh::NodalCoordinates &nc, Mesh::Connectivity &conn, GeoPrim::CBox &box, std::vector< Mesh::IndexType > &candidates, std::vector< Mesh::IndexType > &cells)
Mesh::IndexType FindPointInCells(const GeoPrim::CPoint &p, const NodalCoordinates &nc, const Connectivity &ec, const std::vector< Mesh::IndexType > &elements, GeoPrim::CVector &natc)
Locate element containing given physical point.
unsigned long time()
Get the value of a system timer with a millisecond precision.
void Init(const std::vector< T > &inflatextent)
void merge(const CBox &b)
int CollideMeshWithBox(Mesh::NodalCoordinates &nc, Mesh::Connectivity &conn, GeoPrim::CBox &box, std::vector< Mesh::IndexType > &cells)
long double dist(long double *coord1, long double *coord2, int size)
IRAD::Primitive::IndexType IndexType
Simple Block Structured Mesh object.
const CPoint & P1() const