Chi-Tech
printsweepordering.cc
Go to the documentation of this file.
1#include "../chi_mesh.h"
2#include "../MeshContinuum/chi_meshcontinuum.h"
3#include "sweep_namespace.h"
4#include <fstream>
5
6#include "../MeshHandler/chi_meshhandler.h"
7#include "mesh/Cell/cell.h"
8
9#include "../MeshContinuum/chi_meshcontinuum.h"
10#include "../VolumeMesher/chi_volumemesher.h"
11
13
14//###################################################################
15/**Print a sweep ordering to file.*/
18 MeshContinuumPtr vol_continuum)
19{
20// double polar = sweep_order->polar;
21// double azimuthal = sweep_order->azimuthal;
22//
23// chi_mesh::MeshHandler* cur_handler = GetCurrentHandler();
24// chi_mesh::VolumeMesher* mesher = cur_handler->volume_mesher;
25//
26// //======================================================= Making containers
27// std::vector<int> rank_of_cell;
28// for (int c=0; c<vol_continuum->cells.size(); c++)
29// {
30// rank_of_cell.push_back(0);
31// }
32//
33// chi_mesh::Vector3 omega;
34// omega.x = sin(polar)*cos(azimuthal);
35// omega.y = sin(polar)*sin(azimuthal);
36// omega.z = cos(polar);
37//
38//
39// //======================================================= Traverse the graph
40// int max_rank=-1;
41//
42// for (int ci=0; ci<sweep_order->spls_->item_id.size(); ci++)
43// {
44// int cell_index = sweep_order->spls_->item_id[ci];
45// chi_mesh::Cell* cell = vol_continuum->cells[cell_index];
46//
47// for (int e=0; e < cell->faces.size(); e++)
48// {
49// //======================================= Determine if the face
50// // is incident
51// bool is_incoming = false;
52// double dot_normal = omega.Dot(cell->faces[e].normal);
53// if (dot_normal<0.0) {is_incoming = true;}
54//
55// //======================================= If incoming determine if
56// // it is locally dependent
57// if (is_incoming)
58// {
59// int adj_index = cell->faces[e].neighbor;
60//
61// for (int lc=0;
62// lc<vol_continuum->local_cell_glob_indices.size(); lc++)
63// {
64// if (adj_index == vol_continuum->local_cell_glob_indices[lc])
65// {
66// if (rank_of_cell[cell_index]==0)
67// {
68// rank_of_cell[cell_index] = rank_of_cell[adj_index]+1;
69// printf("Sweep cell %d, rank %d\n",ci,rank_of_cell[cell_index]);
70// if (max_rank<rank_of_cell[cell_index])
71// {
72// max_rank = rank_of_cell[cell_index];
73// }
74// }
75// break;
76// }
77// }
78// }
79//
80// }//for face
81// }
82//
83// printf("Max rank=%d\n",max_rank);
84//
85// //======================================================= Sort ranks into
86// // flags
87// std::vector<int>* ranked_cells;
88// std::vector<std::vector<int>*> ranks;
89//
90// for (int i=0; i<(max_rank+1); i++)
91// {
92// ranked_cells = new std::vector<int>;
93// ranks.push_back(ranked_cells);
94// }
95//
96// for (int c=0; c<vol_continuum->cells.size(); c++)
97// {
98// int rank = rank_of_cell[c];
99// ranks[rank]->push_back(c);
100// }
101//
102// //for (int sp=0; sp<sweep_order->spls_.size(); sp++)
103// for (int sp=0; sp<(max_rank+1); sp++)
104// //for (int sp=0; sp<1; sp++)
105// {
106// std::string file_name("SweepMesh");
107// file_name = file_name + std::to_string(sp)+std::string(".py");
108// vol_continuum->ExportCellsToPython(
109// file_name.c_str(),true,
110// ranks[sp],1);
111// }
112}
void PrintSweepOrdering(SPDS *sweep_order, MeshContinuumPtr vol_continuum)
std::shared_ptr< MeshContinuum > MeshContinuumPtr
Definition: chi_mesh.h:44