24 #define USE_STD_INCLUDES 1
25 #define USE_C_PREFIX_INCLUDES 1
27 #include "MeshImpl.hpp"
28 #include "MesquiteError.hpp"
29 #include "InstructionQueue.hpp"
30 #include "MeshSet.hpp"
31 #include "TerminationCriterion.hpp"
32 #include "QualityAssessor.hpp"
33 #include "PlanarDomain.hpp"
34 #include "ShapeImprovementWrapper.hpp"
37 #include "MeanRatioQualityMetric.hpp"
38 #include "EdgeLengthQualityMetric.hpp"
39 #include "LPtoPTemplate.hpp"
40 #include "FeasibleNewton.hpp"
41 #include "ConjugateGradient.hpp"
42 #include "MsqMessage.hpp"
45 using namespace Mesquite;
66 std::cout <<
" Entering Rocmop::smooth_mesquite_ng" << std::endl;
68 const std::string surf_attr(
"is_surface");
69 COM::Attribute* w_is_surface = _wrk_window->attribute(surf_attr);
90 if(_verb > 2) std::cout <<
" Declaring Variables\n";
93 COM::Attribute *w_new_coords =
94 _wrk_window->new_attribute(
"new_coords",
'n',
COM_DOUBLE, 3,
"");
95 _wrk_window->resize_array(w_new_coords, 0);
98 COM::Attribute *w_adj_elem_cnts =
99 _wrk_window->new_attribute(
"adj_elem_cnts",
'n',
COM_DOUBLE, 1,
"");
100 _wrk_window->resize_array(w_adj_elem_cnts, 0);
101 _wrk_window->init_done();
104 COM::Attribute *w_safe_dist =
105 _wrk_window->new_attribute(
"safe_dist",
'n',
COM_DOUBLE, 1,
"");
106 _wrk_window->resize_array(w_safe_dist, 0);
107 _wrk_window->init_done();
110 COM::Attribute *w_backup =
111 _wrk_window->new_attribute(
"backup",
'n',
COM_DOUBLE, 3,
"");
112 _wrk_window->resize_array(w_backup, 0);
113 _wrk_window->init_done();
116 COM::Attribute *w_reset =
117 _wrk_window->new_attribute(
"reset",
'n',
COM_INT, 1,
"");
118 _wrk_window->resize_array(w_reset, 0);
119 _wrk_window->init_done();
123 double dlarge =99999999;
136 std::vector<COM::Pane*> allpanes;
137 _wrk_window->panes(allpanes);
141 std::vector<std::vector<bool> > is_sub_bnd;
142 std::vector<std::vector<bool> > is_pan_bnd;
143 is_sub_bnd.resize(total_npanes);
144 is_pan_bnd.resize(total_npanes);
147 int new_coords_id = w_new_coords->id();
148 int adj_elem_cnts_id = w_adj_elem_cnts->id();
149 int is_surface_id = w_is_surface->id();
150 int safe_dist_id = w_safe_dist->id();
151 int reset_id = w_reset->id();
152 int backup_id = w_backup->id();
155 int pconn_offset = MAP::Pane_connectivity::pconn_offset();
159 if(_verb > 2) std::cout <<
" Step 1\n";
161 int size_of_real_nodes = allpanes[
i]->size_of_real_nodes();
162 int size_of_real_elems = allpanes[
i]->size_of_real_elements();
163 is_sub_bnd[
i].resize(size_of_real_nodes,0);
164 is_pan_bnd[
i].resize(size_of_real_nodes,0);
166 std::vector<bool> is_isolated;
167 MAP::Pane_boundary pb (allpanes[
i]);
168 pb.determine_border_nodes(is_pan_bnd[i], is_isolated);
173 COM::Attribute *p_is_surface = allpanes[
i]->attribute(is_surface_id);
174 int *is_surface_ptr = (
int*)p_is_surface->pointer();
176 double * adj_elem_cnts_ptr =
reinterpret_cast<double*
>
177 (allpanes[
i]->attribute(adj_elem_cnts_id)->pointer());
179 double * safe_dist_ptr =
180 (
double*)(allpanes[i]->attribute(safe_dist_id)->pointer());
183 (allpanes[
i]->attribute(
COM_NC)->pointer());
186 (allpanes[
i]->attribute(new_coords_id)->pointer());
190 const int *vs = (
const int*)pconn->pointer() + pconn_offset;
191 int vs_size = pconn->size_of_real_items() - pconn_offset;
195 for (
int j=0,
nj=vs_size;
j<
nj;
j+=vs[
j+1]+2) {
196 if (_wrk_window->owner_rank( vs[
j]) >=0) ++count;
201 for (
int j=0;
j<count; ++
j, index+=vs[index+1]+2) {
203 while ( _wrk_window->owner_rank(vs[index])<0) {
204 index+=vs[index+1]+2;
208 for(
int k=0;
k<vs[index+1]; ++
k){
209 is_sub_bnd[
i][vs[index+2+
k]-1]=1;
214 for (
int j =0;
j < size_of_real_nodes; ++
j){
215 if(is_surface_ptr[
j])
216 is_sub_bnd[
i][
j] = 0;
223 Element_node_enumerator ene(allpanes[i],1);
224 for(
int j =0;
j < size_of_real_elems; ++
j, ene.next()){
226 int nn = ene.size_of_nodes(), flag = 0;
227 for(
int k =0;
k < nn; ++
k){
228 if(is_sub_bnd[i][ene[
k]-1]){
230 adj_elem_cnts_ptr[ene[
k]-1] += 1.0;
237 for(
int k =0;
k < nn; ++
k){
238 elem_cntr_pos += pnts[ene[
k]-1];
240 elem_cntr_pos /= (double)nn;
244 for(
int k =0;
k < nn; ++
k){
245 if(is_sub_bnd[i][ene[
k]-1]){
247 double local_safe_dist = (pnts[ene[
k]-1] - elem_cntr_pos).
norm();
249 double long_dist = -1.0;
252 int safe_source = -1;
253 for(
int ii=1; ii<nn; ++ii){
254 double cur_edge_dist =
255 .5*(pnts[ene[
k]-1] - pnts[ene[(
k+ii)%nn]-1]).norm();
256 if(cur_edge_dist < local_safe_dist){
258 local_safe_dist = cur_edge_dist;
260 if(cur_edge_dist > long_dist){
261 long_dist = cur_edge_dist;
265 new_coords_ptr[ene[
k]-1] += elem_cntr_pos;
267 if(safe_source == -1)
268 new_coords_ptr[ene[
k]-1] += elem_cntr_pos;
271 (pnts[ene[(
k+long_src)%nn]-1] - pnts[ene[
k]-1]);
273 new_coords_ptr[ene[
k]-1] += pnts[ene[
k]-1];
274 new_coords_ptr[ene[
k]-1] += direction*local_safe_dist;
278 if(local_safe_dist < safe_dist_ptr[ene[
k]-1])
279 safe_dist_ptr[ene[
k]-1] = local_safe_dist;
287 if(_verb > 1) std::cout <<
" Step 2\n";
288 reduce_sum_on_shared_nodes(w_new_coords);
289 reduce_sum_on_shared_nodes(w_adj_elem_cnts);
291 MAP::Pane_communicator pc(_wrk_window, _wrk_window->get_communicator());
292 pc.init(w_safe_dist);
293 pc.begin_update_shared_nodes();
294 pc.reduce_on_shared_nodes(
MPI_MIN);
295 pc.end_update_shared_nodes();
299 if(_verb > 1) std::cout <<
" Step 3\n";
300 Rocblas::div(w_new_coords, w_adj_elem_cnts, w_new_coords);
307 std::vector<std::vector<bool> > elem_to_check;
308 mark_elems_from_nodes(is_sub_bnd, elem_to_check);
311 double max_angle = 0.0;
312 double min_angle = 180.0;
313 double angles[] = {0.0, 0.0};
314 for(
int i=0,
ni = allpanes.size();
i<
ni; ++
i){
315 for(
int k =0,
nk = elem_to_check[
i].size();
k<
nk; ++
k){
316 if(elem_to_check[
i][
k]){
317 Element_node_enumerator ene(allpanes[
i],k+1);
321 if(angles[1]>max_angle)
322 max_angle = angles[1];
323 if(angles[0]<min_angle)
324 min_angle = angles[0];
329 double temp = min_angle;
331 agree_double(max_angle,
MPI_MAX);
332 agree_double(min_angle,
MPI_MIN);
333 int ierr = MPI_Comm_rank( _wrk_window->get_communicator()
338 if(_verb > 1) std::cout <<
" Step 4\n";
346 attribute(new_coords_id)->
353 double* safe_dist_ptr =
354 (
double*)(allpanes[
i]->attribute(safe_dist_id)->pointer());
356 for (
int j = 0,
nj = allpanes[
i]->size_of_real_nodes();
j<
nj; ++
j){
357 if(is_sub_bnd[
i][
j]){
359 new_coords_ptr[
j] - coords_ptr[
j];
361 if (dist > safe_dist_ptr[j]){
362 double alpha = .9*safe_dist_ptr[
j]/
dist;
364 alpha*new_coords_ptr[
j] +(1.0-alpha)*coords_ptr[j];
367 coords_ptr[
j] = .5*new_coords_ptr[
j] +.5*coords_ptr[
j];
383 (
int*)(allpanes[
i]->attribute(reset_id)->pointer());
385 for(
int k =0,
nk = elem_to_check[
i].size();
k<
nk; ++
k){
386 if(elem_to_check[
i][
k]){
387 double angles[] = {0.0, 0.0};
389 Element_node_enumerator ene(allpanes[
i],k+1);
393 if(angles[1]>max_angle ||
394 angles[0]<min_angle){
395 std::vector<int> nodes;
396 ene.get_nodes(nodes);
397 for(
int j =0,
nj=nodes.size();
j<
nj; ++
j){
398 if (is_sub_bnd[i][nodes[
j]-1])
399 reset_ptr[nodes[
j]-1] = 1;
414 attribute(backup_id)->
422 (
int*)(allpanes[
i]->attribute(reset_id)->pointer());
424 for(
int j=0,
nj = allpanes[
i]->size_of_real_nodes();
j<
nj; ++
j){
426 coords_ptr[
j] = backup_ptr[
j];
438 smooth_mesquite(allpanes,0);
448 _wrk_window->delete_attribute( w_adj_elem_cnts->name());
449 _wrk_window->delete_attribute( w_new_coords->name());
450 _wrk_window->init_done();
453 std::cout <<
" Exiting Rocmop::smooth_mesquite_ng" << std::endl;
459 : _a(a), _b(b), _c(c), _d(d) {}
463 return _a<x.
_a || (_a==x.
_a && (_b<x.
_b || _b==x.
_b &&
464 (_c<x.
_c || _c==x.
_c && _d<x.
_d)));
476 "Surface-list must have integer type");
478 "Surface-list must be nodal");
480 "Surface-list must have a single component");
481 int w_is_surface_id = w_is_surface->id();
504 std::vector<bool> is_border;
505 std::vector<bool> is_shared;
506 std::vector<bool> is_isolated;
507 std::vector<MAP::Facet_ID> border_facet_list;
517 std::vector<std::set<MAP::Facet_ID> > border_facets;
518 std::vector<std::vector<Corners2Face_Map> > maybe_shared;
519 std::vector<std::vector<Id_Map > > lid2ind;
520 std::vector<std::vector<Id_Map > > ind2lid;
521 std::vector<std::vector<std::set<int> > > adj_pane_set;
522 std::vector<std::vector<int> > adj_pane_id;
523 std::vector<std::vector<int> > adj_pane_recv;
526 std::vector<int> send_sizes;
528 std::set<MAP::Facet_ID>::iterator bf_it, bf_it2;
529 Id_Map::iterator idm_it,idm_it2;
530 Corners2Face_Map::iterator ms_it,ms_it2;
531 std::set<int >::iterator aps_it, aps_it2;
534 int pconn_offset = MAP::Pane_connectivity::pconn_offset();
537 std::vector<COM::Pane*> allpanes;
538 COM::Window * wrk_window = w_is_surface->window();
539 wrk_window->panes(allpanes);
541 border_facets.resize(total_npanes);
542 maybe_shared.resize(total_npanes);
543 lid2ind.resize(total_npanes);
544 ind2lid.resize(total_npanes);
545 adj_pane_set.resize(total_npanes);
546 adj_pane_id.resize(total_npanes);
547 adj_pane_recv.resize(total_npanes);
548 send_sizes.resize(total_npanes);
551 COM::Attribute * false_pconn = wrk_window->new_attribute(
"false_pconn",
'p',
COM_INT, 1,
"");
555 COM::Attribute *com_buff = wrk_window->new_attribute(
"com_buff",
'p',
COM_INT, 1,
"");
556 int w_com_buff_id = com_buff->id();
560 int size_of_real_nodes = allpanes[
i]->size_of_real_nodes();
564 is_border.resize(size_of_real_nodes,0);
565 is_shared.resize(size_of_real_nodes,0);
566 is_isolated.resize(size_of_real_nodes,0);
571 MAP::Pane_boundary pb(allpanes[
i]);
572 pb.determine_border_nodes(is_border, is_isolated, &border_facet_list);
575 for(
int j =0,
nj=border_facet_list.size();
j<
nj; ++
j)
576 border_facets[i].insert(border_facet_list[
j]);
583 const int *vs = (
const int*)pconn->pointer() + pconn_offset;
584 int vs_size = pconn->size_of_real_items() - pconn_offset;
588 for (
int j=0, nj=vs_size; j<
nj; j+=vs[j+1]+2) {
589 if (wrk_window->owner_rank( vs[j]) >=0) ++count;
594 maybe_shared[
i].resize(count);
595 lid2ind[
i].resize(count);
596 ind2lid[
i].resize(count);
597 adj_pane_set[
i].resize(count);
598 adj_pane_id[
i].resize(count);
599 adj_pane_recv[
i].resize(count);
603 for (
int j=0; j<count; ++
j, index+=vs[index+1]+2) {
605 while ( wrk_window->owner_rank(vs[index])<0) {
606 index+=vs[index+1]+2;
609 adj_pane_id[
i][
j] = vs[index];
612 for(
int k=0;
k<vs[index+1]; ++
k){
613 is_shared[vs[index+2+
k]-1]=1;
614 adj_pane_set[
i][
j].insert(vs[index+2+
k]);
615 lid2ind[
i][
j].insert(std::make_pair(vs[index+2+
k],
k));
616 ind2lid[
i][
j].insert(std::make_pair(
k,vs[index+2+
k]));
621 std::cout <<
"Pane " << allpanes[
i]->id() <<
" lid2ind = \n";
622 for(
int j=0; j < count; ++
j){
623 std::cout <<
" to Pane " << adj_pane_id[
i][
j] <<
" =\n";
624 for(
int k =0;
k < ind2lid[
i][
j].size();++
k){
625 std::cout <<
"(" <<
k <<
"," << ind2lid[
i][
j][
k] <<
") ";
629 std::cout <<
"Pane " << i <<
"\n"
630 <<
" shared nodes = \n";
632 for(
int j=0; j<is_shared.size(); ++
j){
634 std::cout << j+1 <<
" ";
636 std::cout <<
"\n\n nodes shared with othe panes";
638 aps_it = adj_pane_set[
i][0].begin();
639 for(; aps_it != adj_pane_set[
i][0].end(); ++aps_it){
640 std::cout << *aps_it <<
" ";
648 bf_it2 = border_facets[
i].end();
649 bf_it = border_facets[
i].begin();
651 for(; bf_it != bf_it2; ++bf_it){
652 Element_node_enumerator ene(allpanes[i], (*bf_it).eid());
653 Facet_node_enumerator fne (&ene, (*bf_it).lid());
655 if( is_shared[fne[0]-1] &&
656 is_shared[fne[1]-1] &&
657 is_shared[fne[2]-1] &&
658 fne.size_of_edges()>3?is_shared[fne[3]-1]:1
661 Four_tuple ns( fne[0], fne[1], fne[2], fne.size_of_edges()>3?fne[3]:-1);
662 for(
int k=0;
k<count; ++
k){
663 aps_it2 = adj_pane_set[
i][
k].end();
664 if(aps_it2 != adj_pane_set[i][
k].find(fne[0]) &&
665 aps_it2 != adj_pane_set[i][
k].find(fne[1]) &&
666 aps_it2 != adj_pane_set[i][
k].find(fne[2]) &&
667 (fne.size_of_edges()>3?(adj_pane_set[
i][
k].find(fne[3]) != aps_it2):1)){
670 Four_tuple ns( fne[0], fne[1], fne[2], fne.size_of_edges()>3?fne[3]:-1);
671 std::sort(&ns[0],&ns[4]);
672 maybe_shared[
i][
k].insert(std::make_pair(ns,(*bf_it)));
680 std::cout <<
"Pane " << allpanes[
i]->id() <<
" possibly shared panes\n";
681 for(
int j = 0; j<count; ++
j){
682 std::cout <<
" faces possibly shared with Pane " << adj_pane_id[
i][
j] <<
"\n";
683 ms_it2 = maybe_shared[
i][
j].end();
684 for(ms_it = maybe_shared[i][j].begin(); ms_it != ms_it2; ++ms_it){
685 std::cout <<
"(" << (ms_it->first)[0] <<
" "
686 << (ms_it->first)[1] <<
" "
687 << (ms_it->first)[2] <<
" "
688 << (ms_it->first)[3] <<
") ";
694 wrk_window->set_size(
"com_buff", allpanes[i]->
id(), count, 0);
696 wrk_window->resize_array(
"com_buff", (
const int)allpanes[i]->
id(),
697 reinterpret_cast<void**>(&my_buff));
704 int my_size = 3*pconn_offset + 3 + 6*count;
706 wrk_window->set_size(
"false_pconn", allpanes[i]->
id(), my_size,
707 my_size-(3+pconn_offset));
708 wrk_window->resize_array(
"false_pconn", (
const int)allpanes[i]->
id(),
709 reinterpret_cast<void**>(&my_pconn));
711 if(pconn_offset){my_pconn[0]=1;++my_pconn;}
712 my_pconn[0]=1; my_pconn[1]=1; my_pconn[2]=1;
716 if(pconn_offset){my_pconn[0]=count;++my_pconn;}
717 for(
int j=0; j<count; ++
j){
719 my_pconn[0] = adj_pane_id[
i][
j];
726 my_buff[
j] = 4*maybe_shared[
i][
j].size();
727 send_sizes[
i] += my_buff[
j];
731 if(pconn_offset){my_pconn[0]=count;++my_pconn;}
732 for(
int j=0; j<count; ++
j){
733 my_pconn[0] = adj_pane_id[
i][
j];
740 for (
int j=0; j<count; ++
j, index+=vs[index+1]+2) {
742 while ( wrk_window->owner_rank(vs[index])<0)
743 index+=vs[index+1]+2;
746 my_pconn[3*
j] = vs[index];
748 my_pconn[3*j+2] = j+1;
750 my_pconn[3*(count+
j)+pconn_offset] = vs[index];
751 my_pconn[3*(count+
j)+1+pconn_offset] = 1;
752 my_pconn[3*(count+
j)+2+pconn_offset] = j+1;
754 my_pconn[3*(2*count+
j)+2*pconn_offset] = vs[index];
755 my_pconn[3*(2*count+
j)+1+2*pconn_offset] = 1;
756 my_pconn[3*(2*count+
j)+2+2*pconn_offset] = j+1;
760 my_buff[
j] = 4*maybe_shared[
i][
j].size();
761 send_sizes[
i] += my_buff[
j];
765 std::cout <<
"pconn_offset = " << pconn_offset <<
"\n";
766 std::cout <<
"total size = " << my_size <<
"\n";
767 std::cout <<
"ghost sized = " << my_size - pconn_offset <<
"\n\n";
770 wrk_window->init_done();
775 std::cout <<
"FALSE pconn for pane " << allpanes[
i]->id() << std::endl;
776 COM::Attribute *my_pconn = allpanes[
i]->attribute(w_false_pconn_id);
777 int* ptr = (
int*)my_pconn->pointer();
778 for(
int k=0,
nk=my_pconn->size_of_items();
k<
nk;++
k){
779 std::cout << ptr[
k] <<
" ";
784 std::cout <<
"size of face list\n";
785 COM::Attribute *my_bsize = allpanes[
i]->attribute(w_com_buff_id);
786 ptr = (
int*)my_bsize->pointer();
787 for(
int j =0;
j<my_bsize->size_of_items(); ++
j)
788 std::cout << ptr[
j] <<
" ";
801 COM::Attribute *my_pconn = allpanes[
i]->attribute(w_false_pconn_id);
802 int* ptr = (
int*)my_pconn->pointer();
803 for(
int k=0,
nk=my_pconn->size_of_items();
k<
nk;++
k){
804 std::cout << ptr[
k] <<
" ";
808 std::cout <<
"possibly shared faces\n";
809 for(ms_it = maybe_shared[
i][0].begin(), ms_it2 = maybe_shared[
i][0].end();
810 ms_it != ms_it2; ++ms_it){
812 << (ms_it->first)[0] <<
" "
813 << (ms_it->first)[1] <<
" "
814 << (ms_it->first)[2] <<
" "
815 << (ms_it->first)[3] <<
") ";
819 std::cout <<
"size of communicated face list\n";
820 COM::Attribute *my_bsize = allpanes[
i]->attribute(w_com_buff_id);
821 ptr = (
int*)my_bsize->pointer();
822 for(
int j =0;
j <adj_pane_id[
i].size(); ++
j)
823 std::cout << ptr[
j] <<
" ";
833 COM::Attribute *p_com_buff = allpanes[
i]->attribute(w_com_buff_id);
834 int *com_buff_ptr = (
int*)p_com_buff->pointer();
837 int count = adj_pane_id[
i].size();
842 for(
int j=0;
j< count; ++
j){
843 recv_size += com_buff_ptr[
j];
844 adj_pane_recv[
i][
j] = com_buff_ptr[
j];
846 int send_size = send_sizes[
i];
853 int pconn_size = 3*(pconn_offset)+3+4*count+recv_size+send_size;
857 std::cout <<
" SIZES\nrecv_size = " << recv_size <<
" send_size = " << send_size
858 <<
" pconn size = " << pconn_size <<
"\n"
859 <<
" 3*pconn_offset = " << 3*pconn_offset
860 <<
" 4*count = " << 4*count <<
"\n\n";
864 wrk_window->set_size(
"com_buff", allpanes[
i]->
id(),
std::max(send_size,recv_size),0);
865 wrk_window->resize_array(
"com_buff", (
const int)allpanes[
i]->
id(),
866 reinterpret_cast<void**>(&com_buff_ptr));
868 wrk_window->set_size(
"false_pconn", allpanes[
i]->
id(), pconn_size,
869 pconn_size - (3+pconn_offset));
870 wrk_window->resize_array(
"false_pconn", (
const int)allpanes[
i]->
id(),
871 reinterpret_cast<void**>(&pconn_ptr));
874 if(pconn_offset){pconn_ptr[0]=1;++pconn_ptr;}
875 pconn_ptr[0]=1; pconn_ptr[1]=1; pconn_ptr[2]=1;
879 if(pconn_offset){pconn_ptr[0]=count;++pconn_ptr;}
881 for(
int j =0;
j<count; ++
j){
882 pconn_ptr[0]=adj_pane_id[
i][
j];
883 pconn_ptr[1]=4*maybe_shared[
i][
j].size();
885 ms_it2 = maybe_shared[
i][
j].end();
886 for(ms_it = maybe_shared[
i][
j].begin(); ms_it != ms_it2;
887 ++ms_it, com_ind+=4, pconn_ptr+=4){
891 com_buff_ptr[com_ind] = -1;
893 idm_it = lid2ind[
i][
j].find((*ft)[0]);
894 idm_it = lid2ind[
i][
j].find((*ft)[1]);
895 com_buff_ptr[com_ind+1] = idm_it->second;
896 idm_it = lid2ind[
i][
j].find((*ft)[2]);
897 com_buff_ptr[com_ind+2] = idm_it->second;
898 idm_it = lid2ind[
i][
j].find((*ft)[3]);
899 com_buff_ptr[com_ind+3] = idm_it->second;
900 std::sort(&com_buff_ptr[com_ind],&com_buff_ptr[com_ind+4]);
902 pconn_ptr[0] = com_ind+1;
903 pconn_ptr[1] = com_ind+2;
904 pconn_ptr[2] = com_ind+3;
905 pconn_ptr[3] = com_ind+4;
910 if(pconn_offset){pconn_ptr[0]=count;++pconn_ptr;}
912 for(
int j=0;
j<count; ++
j){
913 pconn_ptr[0]=adj_pane_id[
i][
j];
914 pconn_ptr[1]=adj_pane_recv[
i][
j];
915 for(
int k=0;
k<adj_pane_recv[
i][
j]; ++
k){
916 pconn_ptr[
k+2] =
k+com_ind;
918 com_ind += adj_pane_recv[
i][
j];
919 pconn_ptr += 2+adj_pane_recv[
i][
j];
926 std::cout <<
"Facet list FALSE pconn for pane " << allpanes[
i]->id() << std::endl;
927 COM::Attribute *my_pconn = allpanes[
i]->attribute(w_false_pconn_id);
928 int* ptr = (
int*)my_pconn->pointer();
929 for(
int k=0,
nk=my_pconn->size_of_items();
k<
nk;++
k){
930 std::cout << ptr[
k] <<
" ";
934 std::cout <<
"Facet list buffer for pane " << allpanes[
i]->id() << std::endl;
935 COM::Attribute *my_buff = allpanes[
i]->attribute(w_com_buff_id);
936 ptr = (
int*)my_buff->pointer();
937 for(
int k=0,nk=my_buff->size_of_items();
k<
nk;++
k){
938 std::cout << ptr[
k] <<
" ";
951 std::cout <<
"Updated Facet list buffer for pane " << allpanes[
i]->id() << std::endl;
952 COM::Attribute *my_buff = allpanes[
i]->attribute(w_com_buff_id);
953 int* ptr = (
int*)my_buff->pointer();
954 for(
int k=0,
nk=my_buff->size_of_items();
k<
nk;++
k){
955 std::cout << ptr[
k] <<
" ";
964 COM::Attribute *my_buff = allpanes[
i]->attribute(w_com_buff_id);
965 int* buff_ptr = (
int*)my_buff->pointer();
967 int count = adj_pane_recv[
i].size();
970 for(
int j=0;
j<count; buff_ptr += adj_pane_recv[
i][
j], ++
j){
975 for(
int k=0,
nk =adj_pane_recv[
i][
j];
k<
nk; ++
k){
977 buff_ptr[
k] = ind2lid[
i][
j][buff_ptr[
k]];
982 ms_it2 = maybe_shared[
i][
j].end();
983 bf_it2 = border_facets[
i].end();
984 for(
int k=0, nk=adj_pane_recv[
i][
j];
k<
nk;
k+=4){
985 Four_tuple ns(buff_ptr[
k],buff_ptr[k+1],buff_ptr[k+2],buff_ptr[k+3]);
986 std::sort(&ns[0],&ns[4]);
988 ms_it = maybe_shared[
i][
j].find(ns);
991 Element_node_enumerator ene(allpanes[
i], (ms_it->second).eid());
992 Facet_node_enumerator fne (&ene, (ms_it->second).lid());
998 MAP::Facet_ID fid = ms_it->second;
999 bf_it = border_facets[
i].find(fid);
1001 border_facets[
i].erase(fid);
1016 bf_it2 = border_facets[
i].end();
1017 for(bf_it = border_facets[
i].begin(); bf_it!= bf_it2; ++bf_it){
1018 Element_node_enumerator ene(allpanes[
i], (*bf_it).eid());
1019 Facet_node_enumerator fne (&ene, (*bf_it).lid());
1031 COM::Attribute *p_is_surface = allpanes[
i]->attribute(w_is_surface_id);
1032 int* surf_ptr = (
int*)p_is_surface->pointer();
1034 for(
int j=0,
nj= p_is_surface->size_of_items();
j<
nj; ++
j){
1037 bf_it2 = border_facets[
i].end();
1039 for(bf_it = border_facets[
i].begin(); bf_it!= bf_it2; ++bf_it){
1040 Element_node_enumerator ene(allpanes[
i], (*bf_it).eid());
1041 Facet_node_enumerator fne (&ene, (*bf_it).lid());
1042 surf_ptr[fne[0]-1] = 1;
1043 surf_ptr[fne[1]-1] = 1;
1044 surf_ptr[fne[2]-1] = 1;
1046 if(fne.size_of_edges()>3)
1047 surf_ptr[fne[3]-1] = 1;
1072 wrk_window->delete_attribute(com_buff->name());
1073 wrk_window->delete_attribute(false_pconn->name());
bool operator<(const Four_tuple &x) const
void determine_physical_border()
Determine which nodes and elements are on the physical border.
A structure used to represent element faces.
Utility for constructing pane connectivities in parallel.
std::map< int, int > Id_Map
virtual void compute(double atts[]) const
Calculate the metric value on this element.
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MAX
Contains the prototypes for the Pane object.
#define COM_assertion_msg(EX, msg)
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
This file contains the prototypes for Roccom API.
3D geometric quality Metric declarations.
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_GROUP_EMPTY INTEGER MPI_MIN
const int & operator[](int i) const
Handles communication of shared nodes, ghost nodes or ghost cells across panes.
std::map< Four_tuple, Facet_ID > Corners2Face_Map
T norm(const NVec< DIM, T > &v)
static void reduce_maxabs_on_shared_nodes(COM::Attribute *att, COM::Attribute *pconn=NULL)
Perform a maxabs-reduction on the shared nodes for the given attribute.
void smooth_vol_mesq_ng()
Smooths a volume using Mesquite with only shared node information.
int COM_compatible_types(COM_Type type1, COM_Type type2)
static void div(const Attribute *x, const Attribute *y, Attribute *z)
Operation wrapper for division.
Four_tuple(int a, int b, int c, int d)
#define MOP_END_NAMESPACE
virtual void initialize(Vector_3< double > n[], int type)
Initialize a 3D Geometric Metric by nodal coords and element type.
Definition for Rocblas API.
static void copy_scalar(const void *x, Attribute *y)
Operation wrapper for copy (x is a scalar pointer).
static void update_ghosts(COM::Attribute *att, const COM::Attribute *pconn=NULL)
Update ghost nodal or elemental values for the given attribute.
#define MOP_BEGIN_NAMESPACE
3D Max and Min Angle Metric Class
static void copy(const Attribute *x, Attribute *y)
Wrapper for copy.
void int int REAL REAL REAL *z blockDim dim * ni
long double dist(long double *coord1, long double *coord2, int size)
Utility for detecting boundaries of a pane.