Nektar++
Public Member Functions | Private Attributes | List of all members
Nektar::Utilities::Iso Class Reference

#include <ProcessIsoContour.h>

Collaboration diagram for Nektar::Utilities::Iso:
Collaboration graph
[legend]

Public Member Functions

void condense (void)
 
void globalcondense (vector< boost::shared_ptr< Iso > > &iso)
 
void separate_regions (vector< boost::shared_ptr< Iso > > &iso, int minsize)
 
void smooth (int n_iter, NekDouble lambda, NekDouble mu)
 
int get_nvert (void)
 
void set_nvert (int n)
 
int get_ntris (void)
 
void set_ntris (int n)
 
void set_fields (const int loc, const Array< OneD, Array< OneD, NekDouble > > &intfields, const int j)
 
NekDouble get_fields (const int i, const int j)
 
void set_x (int loc, NekDouble val)
 
void set_y (int loc, NekDouble val)
 
void set_z (int loc, NekDouble val)
 
NekDouble get_x (int loc)
 
NekDouble get_y (int loc)
 
NekDouble get_z (int loc)
 
int get_vid (int i)
 
void resize_vid (int nconn)
 
void set_vid (int i, int j)
 
void resize_fields (int size)
 
 Iso (int nfields)
 
 ~Iso (void)
 

Private Attributes

bool m_condensed
 
int m_nvert
 
int m_ntris
 
vector< NekDoublem_x
 
vector< NekDoublem_y
 
vector< NekDoublem_z
 
vector< vector< NekDouble > > m_fields
 
Array< OneD, int > m_vid
 

Detailed Description

Definition at line 47 of file ProcessIsoContour.h.

Constructor & Destructor Documentation

Nektar::Utilities::Iso::Iso ( int  nfields)
inline

Definition at line 155 of file ProcessIsoContour.h.

References m_condensed, m_fields, m_nvert, m_x, m_y, and m_z.

156  {
157  m_condensed = false;
158  m_nvert = 0;
159  m_fields.resize(nfields);
160  // set up initial vectors to be 10000 long
161  m_x.resize(10000);
162  m_y.resize(10000);
163  m_z.resize(10000);
164  for(int i = 0; i < m_fields.size(); ++i)
165  {
166  m_fields[i].resize(10000);
167  }
168  };
vector< NekDouble > m_x
vector< vector< NekDouble > > m_fields
vector< NekDouble > m_z
vector< NekDouble > m_y
Nektar::Utilities::Iso::~Iso ( void  )
inline

Definition at line 170 of file ProcessIsoContour.h.

171  {
172  }

Member Function Documentation

void Nektar::Utilities::Iso::condense ( void  )

Definition at line 527 of file ProcessIsoContour.cpp.

References Nektar::StdRegions::find(), Nektar::iterator, m_condensed, m_fields, Nektar::Utilities::IsoVertex::m_fields, Nektar::Utilities::IsoVertex::m_id, m_ntris, m_nvert, m_vid, m_x, Nektar::Utilities::IsoVertex::m_x, m_y, Nektar::Utilities::IsoVertex::m_y, m_z, and Nektar::Utilities::IsoVertex::m_z.

528 {
529  register int i,j,cnt;
530  IsoVertex v;
531  vector<IsoVertex> vert;
533 
534  if(!m_ntris) return;
535 
536  if(m_condensed) return;
537  m_condensed = true;
538 
539  vert.reserve(m_ntris/6);
540 
542 
543  // fill first 3 points and initialise fields
544  v.m_fields.resize(m_fields.size());
545  for(cnt =0, i = 0; i < 3; ++i)
546  {
547  v.m_x = m_x[i];
548  v.m_y = m_y[i];
549  v.m_z = m_z[i];
550  for(int f = 0; f < m_fields.size(); ++f)
551  {
552  v.m_fields[f] = m_fields[f][i];
553  }
554  v.m_id = cnt;
555  vert.push_back(v);
556  m_vid[i] = v.m_id;
557  ++cnt;
558  }
559 
560  for(i = 1; i < m_ntris; ++i)
561  {
562  for(j = 0; j < 3; ++j)
563  {
564  v.m_x = m_x[3*i+j];
565  v.m_y = m_y[3*i+j];
566  v.m_z = m_z[3*i+j];
567 
568  pt = find(vert.begin(),vert.end(),v);
569  if(pt != vert.end())
570  {
571  m_vid[3*i+j] = pt[0].m_id;
572  }
573  else
574  {
575  v.m_id = cnt;
576 
577  for(int f = 0; f < m_fields.size(); ++f)
578  {
579  v.m_fields[f] = m_fields[f][3*i+j];
580  }
581 
582  vert.push_back(v);
583 
584  m_vid[3*i+j] = v.m_id;
585  ++cnt;
586  }
587  }
588  }
589 
590  // remove elements with multiple vertices
591  for(i = 0,cnt=0; i < m_ntris;)
592  {
593  if((m_vid[3*i] ==m_vid[3*i+1])||
594  (m_vid[3*i] ==m_vid[3*i+2])||
595  (m_vid[3*i+1]==m_vid[3*i+2]))
596  {
597  cnt++;
598  for(j = 3*i; j < 3*(m_ntris-1); ++j)
599  {
600  m_vid[j] = m_vid[j+3];
601  }
602  m_ntris--;
603  }
604  else
605  {
606  ++i;
607  }
608  }
609 
610  m_nvert = vert.size();
611 
612  m_x.resize(m_nvert);
613  m_y.resize(m_nvert);
614  m_z.resize(m_nvert);
615 
616  for(int f = 0; f < m_fields.size(); ++f)
617  {
618  m_fields[f].resize(m_nvert);
619  }
620 
621  for(i = 0; i < m_nvert; ++i)
622  {
623  m_x[i] = vert[i].m_x;
624  m_y[i] = vert[i].m_y;
625  m_z[i] = vert[i].m_z;
626  for(int f = 0; f < m_fields.size(); ++f)
627  {
628  m_fields[f][i] = vert[i].m_fields[f];
629  }
630  }
631 }
vector< NekDouble > m_x
vector< vector< NekDouble > > m_fields
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
vector< NekDouble > m_z
Array< OneD, int > m_vid
vector< NekDouble > m_y
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
Definition: StdRegions.hpp:312
NekDouble Nektar::Utilities::Iso::get_fields ( const int  i,
const int  j 
)
inline

Definition at line 90 of file ProcessIsoContour.h.

References m_fields.

91  {
92  return m_fields[i][j];
93  }
vector< vector< NekDouble > > m_fields
int Nektar::Utilities::Iso::get_ntris ( void  )
inline

Definition at line 66 of file ProcessIsoContour.h.

References m_ntris.

67  {
68  return m_ntris;
69  }
int Nektar::Utilities::Iso::get_nvert ( void  )
inline

Definition at line 56 of file ProcessIsoContour.h.

References m_nvert.

57  {
58  return m_nvert;
59  }
int Nektar::Utilities::Iso::get_vid ( int  i)
inline

Definition at line 124 of file ProcessIsoContour.h.

References m_vid.

125  {
126  return m_vid[i];
127  }
Array< OneD, int > m_vid
NekDouble Nektar::Utilities::Iso::get_x ( int  loc)
inline

Definition at line 109 of file ProcessIsoContour.h.

References m_x.

110  {
111  return m_x[loc];
112  }
vector< NekDouble > m_x
NekDouble Nektar::Utilities::Iso::get_y ( int  loc)
inline

Definition at line 114 of file ProcessIsoContour.h.

References m_y.

115  {
116  return m_y[loc];
117  }
vector< NekDouble > m_y
NekDouble Nektar::Utilities::Iso::get_z ( int  loc)
inline

Definition at line 119 of file ProcessIsoContour.h.

References m_z.

120  {
121  return m_z[loc];
122  }
vector< NekDouble > m_z
void Nektar::Utilities::Iso::globalcondense ( vector< boost::shared_ptr< Iso > > &  iso)

Definition at line 662 of file ProcessIsoContour.cpp.

References m_condensed, m_fields, m_ntris, m_nvert, m_vid, m_x, m_y, m_z, and Nektar::Utilities::same().

663 {
664  int i,j,n;
665  int nvert,nelmt;
666  int niso=iso.size();
667  int id1,id2;
669 
670  if(m_condensed) return;
671  m_condensed = true;
672 
673  vidmap = Array<OneD, Array<OneD, int> > (niso);
674 
675  m_ntris = 0;
676  for(i = 0; i < niso; ++i)
677  {
678  if(iso[i]->m_ntris)
679  {
680  m_ntris += iso[i]->m_ntris;
681  }
682  }
683 
685 
686  m_nvert = 0;
687  for(i = 0; i < niso; ++i)
688  {
689  if(iso[i]->m_ntris)
690  {
691  m_nvert += iso[i]->m_nvert;
692  }
693  }
694 
695  vector< vector<int> > isocon;
696  isocon.resize(niso);
697 
698  // identify which iso are connected by at least one point;
699  // find min x,y,z and max x,y,z and see if overlap to select
700  // which zones should be connected
701  {
702  vector<Array<OneD, NekDouble> > sph(niso);
703  Array<OneD, NekDouble> rng(6);
704  for(i = 0; i < niso; ++i)
705  {
706  sph[i] = Array<OneD, NekDouble>(4);
707 
708  // find max and min of isocontour
709  rng[0] = rng[3] = iso[i]->m_x[0];
710  rng[1] = rng[4] = iso[i]->m_x[1];
711  rng[2] = rng[5] = iso[i]->m_x[2];
712 
713  for(id1 = 1; id1 < iso[i]->m_nvert;++id1)
714  {
715  rng[0] = min(rng[0],iso[i]->m_x[i]);
716  rng[1] = min(rng[1],iso[i]->m_y[i]);
717  rng[2] = min(rng[2],iso[i]->m_z[i]);
718 
719  rng[3] = max(rng[3],iso[i]->m_x[i]);
720  rng[4] = max(rng[4],iso[i]->m_y[i]);
721  rng[5] = max(rng[5],iso[i]->m_z[i]);
722  }
723 
724  // centroid
725  sph[i][0] = (rng[3]+rng[0])/2.0;
726  sph[i][1] = (rng[4]+rng[1])/2.0;
727  sph[i][2] = (rng[5]+rng[2])/2.0;
728 
729  // radius;
730  sph[i][3] = sqrt((rng[3]-rng[0])*(rng[3]-rng[0]) +
731  (rng[4]-rng[1])*(rng[4]-rng[1]) +
732  (rng[5]-rng[2])*(rng[5]-rng[2]));
733  }
734 
735  for(i = 0; i < niso; ++i)
736  {
737  for(j = i+1; j < niso; ++j)
738  {
739  NekDouble diff=sqrt((sph[i][0]-sph[j][0])*(sph[i][0]-sph[j][0])+
740  (sph[i][1]-sph[j][1])*(sph[i][1]-sph[j][1])+
741  (sph[i][2]-sph[j][2])*(sph[i][2]-sph[j][2]));
742 
743  // if centroid is closer than added radii
744  if(diff < sph[i][3] + sph[j][3])
745  {
746  isocon[i].push_back(j);
747  }
748  }
749  }
750  }
751 
752 
753  for(i = 0; i < niso; ++i)
754  {
755  vidmap[i] = Array<OneD, int>(iso[i]->m_nvert,-1);
756  }
757  nvert = 0;
758  // identify which vertices are connected to tolerance
759  cout << "GlobalCondense: Matching Vertices [" << endl << flush;
760  int cnt = 0;
761  // count up amount of checking to be done
762  NekDouble totpts = 0;
763  for(i = 0; i < niso; ++i)
764  {
765  for(n = 0; n < isocon[i].size(); ++n)
766  {
767  int con = isocon[i][n];
768  totpts += iso[i]->m_nvert*iso[con]->m_nvert;
769  }
770  }
771  int totchk = totpts/50;
772  int cnt_out = 0;
773  for(i = 0; i < niso; ++i)
774  {
775  for(n = 0; n < isocon[i].size(); ++n)
776  {
777  int con = isocon[i][n];
778  for(id1 = 0; id1 < iso[i]->m_nvert; ++id1)
779  {
780  for(id2 = 0; id2 < iso[con]->m_nvert; ++id2, ++cnt)
781  {
782  if(cnt%totchk == 0)
783  {
784  cout <<cnt_out << "%" << '\r' << flush;
785  cnt_out +=2;
786  }
787 
788  if((vidmap[con][id2] == -1)||(vidmap[i][id1] == -1))
789  {
790  if(same(iso[i]->m_x[id1], iso[i]->m_y[id1],
791  iso[i]->m_z[id1], iso[con]->m_x[id2],
792  iso[con]->m_y[id2],iso[con]->m_z[id2]))
793  {
794  if((vidmap[i][id1] == -1) &&
795  (vidmap[con][id2] != -1))
796  {
797  vidmap[i][id1] = vidmap[con][id2];
798  }
799  else if((vidmap[con][id2] == -1) &&
800  (vidmap[i][id1] != -1))
801  {
802  vidmap[con][id2] = vidmap[i][id1];
803  }
804  else if((vidmap[con][id2] == -1) &&
805  (vidmap[i][id1] == -1))
806  {
807  vidmap[i][id1] = vidmap[con][id2] = nvert++;
808  }
809  }
810  }
811  }
812  }
813  }
814 
815  for(id1 = 0; id1 < iso[i]->m_nvert;++id1)
816  {
817  if(vidmap[i][id1] == -1)
818  {
819  vidmap[i][id1] = nvert++;
820  }
821  }
822  }
823  cout <<endl << "]"<<endl;
824  m_nvert = nvert;
825 
826  nelmt = 0;
827  // reset m_vid;
828  for(n = 0; n < niso; ++n)
829  {
830  for(i = 0; i < iso[n]->m_ntris; ++i,nelmt++)
831  {
832  for(j=0; j < 3;++j)
833  {
834  m_vid[3*nelmt+j] = vidmap[n][iso[n]->m_vid[3*i+j]];
835  }
836  }
837  }
838 
839  m_ntris = nelmt;
840 
841  m_x.resize(m_nvert);
842  m_y.resize(m_nvert);
843  m_z.resize(m_nvert);
844 
845  m_fields.resize(iso[0]->m_fields.size());
846  for(i = 0; i < iso[0]->m_fields.size(); ++i)
847  {
848  m_fields[i].resize(m_nvert);
849  }
850 
851 
852  // reset coordinate and fields.
853  for(n = 0; n < niso; ++n)
854  {
855  for(i = 0; i < iso[n]->m_nvert; ++i)
856  {
857  m_x[vidmap[n][i]] = iso[n]->m_x[i];
858  m_y[vidmap[n][i]] = iso[n]->m_y[i];
859  m_z[vidmap[n][i]] = iso[n]->m_z[i];
860 
861  for(j = 0; j < m_fields.size(); ++j)
862  {
863  m_fields[j][vidmap[n][i]] = iso[n]->m_fields[j][i];
864  }
865  }
866  }
867 }
vector< NekDouble > m_x
double NekDouble
vector< vector< NekDouble > > m_fields
vector< NekDouble > m_z
Array< OneD, int > m_vid
vector< NekDouble > m_y
bool same(NekDouble x1, NekDouble y1, NekDouble z1, NekDouble x2, NekDouble y2, NekDouble z2)
void Nektar::Utilities::Iso::resize_fields ( int  size)
inline

Definition at line 139 of file ProcessIsoContour.h.

References m_fields, m_nvert, m_x, m_y, and m_z.

140  {
141  if(size > m_x.size()) // add 100 element to vectors
142  {
143  m_x.resize(size+1000);
144  m_y.resize(size+1000);
145  m_z.resize(size+1000);;
146  for(int i = 0; i < m_fields.size(); ++i)
147  {
148  m_fields[i].resize(size+100);
149  }
150 
151  }
152  m_nvert = size;
153  }
vector< NekDouble > m_x
vector< vector< NekDouble > > m_fields
vector< NekDouble > m_z
vector< NekDouble > m_y
void Nektar::Utilities::Iso::resize_vid ( int  nconn)
inline

Definition at line 129 of file ProcessIsoContour.h.

References m_vid.

130  {
131  m_vid = Array<OneD, int>(nconn);
132  }
Array< OneD, int > m_vid
void Nektar::Utilities::Iso::separate_regions ( vector< boost::shared_ptr< Iso > > &  iso,
int  minsize 
)

Definition at line 964 of file ProcessIsoContour.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::iterator, m_fields, m_ntris, m_nvert, m_vid, m_x, m_y, m_z, WARNINGL0, and Vmath::Zero().

965  {
966  int i,j,k,id;
969  list<int> tocheck;
971 
972  Array<OneD, bool> viddone(m_nvert,false);
973 
974  // make list of connecting tris around each vertex
975  for(i = 0; i < m_ntris; ++i)
976  {
977  for(j = 0; j < 3; ++j)
978  {
979  vertcon[m_vid[3*i+j]].push_back(i);
980  }
981  }
982 
983  Array<OneD, int> vidregion(m_nvert,-1);
984 
985  int nregions = -1;
986 
987  cout << "Identifying separate regions [." << flush ;
988  // check all points are assigned;
989  for(k = 0; k < m_nvert; ++k)
990  {
991  if(vidregion[k] == -1)
992  {
993  vidregion[k] = ++nregions;
994 
995  // find all elmts around this.. vertex that need to be checked
996  for(ipt = vertcon[k].begin(); ipt != vertcon[k].end(); ++ipt)
997  {
998  for(i = 0; i < 3; ++i)
999  {
1000  if(vidregion[id = m_vid[3*(ipt[0])+i]] == -1)
1001  {
1002  tocheck.push_back(id);
1003  vidregion[id] = nregions;
1004  }
1005  }
1006  }
1007  viddone[k] = 1;
1008 
1009  // check all other neighbouring vertices
1010  while(tocheck.size())
1011  {
1012  cid = tocheck.begin();
1013  while(cid != tocheck.end())
1014  {
1015  if(!viddone[*cid])
1016  {
1017  for(ipt = vertcon[*cid].begin(); ipt != vertcon[*cid].end(); ++ipt)
1018  {
1019  for(i = 0; i < 3; ++i)
1020  {
1021  if(vidregion[id = m_vid[3*(ipt[0])+i]] == -1)
1022  {
1023  tocheck.push_back(id);
1024  vidregion[id] = nregions;
1025  }
1026  }
1027  }
1028  viddone[*cid] = 1;
1029  ++cid;
1030  tocheck.pop_front();
1031  }
1032  }
1033  }
1034  }
1035  }
1036  nregions++;
1037 
1038  cout << "]" << endl << flush ;
1039 
1040  Array<OneD, int> nvert(nregions,0);
1041  Array<OneD, int> nelmt(nregions,0);
1042 
1043  // count nverts
1044  for(i = 0; i < m_nvert; ++i)
1045  {
1046  nvert[vidregion[i]] +=1;
1047  }
1048 
1049  // count nelmts
1050  for(i = 0; i < m_ntris; ++i)
1051  {
1052  nelmt[vidregion[m_vid[3*i]]] +=1;
1053  }
1054 
1055  Array<OneD, int> vidmap(m_nvert);
1056  // generate new list of isocontour
1057  for(int n = 0; n < nregions; ++n)
1058  {
1059  if(nelmt[n] > minsize)
1060  {
1061  int nfields = m_fields.size();
1063 
1064  iso->m_ntris = nelmt[n];
1065  iso->m_vid = Array<OneD, int>(3*nelmt[n]);
1066 
1067  iso->m_nvert = nvert[n];
1068  iso->m_x.resize(nvert[n]);
1069  iso->m_y.resize(nvert[n]);
1070  iso->m_z.resize(nvert[n]);
1071 
1072  iso->m_fields.resize(nfields);
1073  for(i = 0; i < nfields; ++i)
1074  {
1075  iso->m_fields[i].resize(nvert[n]);
1076  }
1077 
1078 
1079  int cnt = 0;
1080  // generate vid map;
1081  Vmath::Zero(m_nvert,vidmap,1);
1082  for(i = 0; i < m_nvert; ++i)
1083  {
1084  if(vidregion[i] == n)
1085  {
1086  vidmap[i] = cnt++;
1087  }
1088  }
1089 
1090  cnt = 0;
1091  for(i = 0; i < m_ntris; ++i)
1092  {
1093  if(vidregion[m_vid[3*i]] == n)
1094  {
1095  for(j = 0; j < 3; ++j)
1096  {
1097  iso->m_vid[3*cnt+j] = vidmap[m_vid[3*i+j]];
1098 
1099  iso->m_x[vidmap[m_vid[3*i+j]]] = m_x[m_vid[3*i+j]];
1100  iso->m_y[vidmap[m_vid[3*i+j]]] = m_y[m_vid[3*i+j]];
1101  iso->m_z[vidmap[m_vid[3*i+j]]] = m_z[m_vid[3*i+j]];
1102 
1103  for(k = 0; k < nfields; ++k)
1104  {
1105  iso->m_fields[k][vidmap[m_vid[3*i+j]]] = m_fields[k][m_vid[3*i+j]];
1106  }
1107  }
1108  cnt++;
1109  }
1110  }
1111 
1112  WARNINGL0(cnt == nelmt[n],"Number of elements do not match");
1113  sep_iso.push_back(iso);
1114  }
1115  }
1116  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
vector< NekDouble > m_x
boost::shared_ptr< Iso > IsoSharedPtr
#define WARNINGL0(condition, msg)
Definition: ErrorUtil.hpp:167
vector< vector< NekDouble > > m_fields
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
vector< NekDouble > m_z
Array< OneD, int > m_vid
vector< NekDouble > m_y
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:359
void Nektar::Utilities::Iso::set_fields ( const int  loc,
const Array< OneD, Array< OneD, NekDouble > > &  intfields,
const int  j 
)
inline

Definition at line 76 of file ProcessIsoContour.h.

References m_fields, m_x, m_y, and m_z.

79  {
80  m_x[loc] = intfields[0][j];
81  m_y[loc] = intfields[1][j];
82  m_z[loc] = intfields[2][j];
83 
84  for(int i = 0; i < intfields.num_elements()-3; ++i)
85  {
86  m_fields[i][loc] = intfields[i+3][j];
87  }
88  }
vector< NekDouble > m_x
vector< vector< NekDouble > > m_fields
vector< NekDouble > m_z
vector< NekDouble > m_y
void Nektar::Utilities::Iso::set_ntris ( int  n)
inline

Definition at line 71 of file ProcessIsoContour.h.

References m_ntris.

72  {
73  m_ntris = n;
74  }
void Nektar::Utilities::Iso::set_nvert ( int  n)
inline

Definition at line 61 of file ProcessIsoContour.h.

References m_nvert.

62  {
63  m_nvert = n;
64  }
void Nektar::Utilities::Iso::set_vid ( int  i,
int  j 
)
inline

Definition at line 134 of file ProcessIsoContour.h.

References m_vid.

135  {
136  m_vid[i] = j;
137  }
Array< OneD, int > m_vid
void Nektar::Utilities::Iso::set_x ( int  loc,
NekDouble  val 
)
inline

Definition at line 94 of file ProcessIsoContour.h.

References m_x.

95  {
96  m_x[loc] = val;
97  }
vector< NekDouble > m_x
void Nektar::Utilities::Iso::set_y ( int  loc,
NekDouble  val 
)
inline

Definition at line 99 of file ProcessIsoContour.h.

References m_y.

100  {
101  m_y[loc] = val;
102  }
vector< NekDouble > m_y
void Nektar::Utilities::Iso::set_z ( int  loc,
NekDouble  val 
)
inline

Definition at line 104 of file ProcessIsoContour.h.

References m_z.

105  {
106  m_z[loc] = val;
107  }
vector< NekDouble > m_z
void Nektar::Utilities::Iso::smooth ( int  n_iter,
NekDouble  lambda,
NekDouble  mu 
)

Definition at line 869 of file ProcessIsoContour.cpp.

References Nektar::iterator, m_ntris, m_nvert, m_vid, m_x, m_y, and m_z.

870 {
871  int iter,i,j;
872  NekDouble del_v[3];
873  NekDouble w;
874  Array<OneD, NekDouble> xtemp, ytemp, ztemp;
875  vector< vector<int> > adj,vertcon;
878 
879  // determine elements around each vertex
880  vertcon.resize(m_nvert);
881  for(i = 0; i < m_ntris; ++i)
882  {
883  for(j = 0; j < 3; ++j)
884  {
885  vertcon[m_vid[3*i+j]].push_back(i);
886  }
887  }
888 
889  // determine vertices around each vertex
890  adj.resize(m_nvert);
891 
892  for(i =0; i < m_nvert; ++i)
893  {
894  for(ipt = vertcon[i].begin(); ipt != vertcon[i].end(); ++ipt)
895  {
896  for(j = 0; j < 3; ++j)
897  {
898  // make sure not adding own vertex
899  if(m_vid[3*(*ipt)+j] != i)
900  {
901  // check to see if vertex has already been added
902  for(iad = adj[i].begin(); iad != adj[i].end();++iad)
903  {
904  if(*iad == (m_vid[3*(*ipt)+j])) break;
905  }
906 
907  if(iad == adj[i].end())
908  {
909  adj[i].push_back(m_vid[3*(*ipt)+j]);
910  }
911  }
912  }
913  }
914  }
915 
919 
920  // smooth each point
921  for (iter=0;iter<n_iter;iter++)
922  {
923  // compute first weighted average
924  for(i=0;i< m_nvert;++i)
925  {
926  w = 1.0/(NekDouble)(adj[i].size());
927 
928  del_v[0] = del_v[1] = del_v[2] = 0.0;
929 
930  for(iad = adj[i].begin(); iad != adj[i].end(); ++iad)
931  {
932  del_v[0] = del_v[0] + (m_x[*iad]-m_x[i])*w;
933  del_v[1] = del_v[1] + (m_y[*iad]-m_y[i])*w;
934  del_v[2] = del_v[2] + (m_z[*iad]-m_z[i])*w;
935  }
936 
937  xtemp[i] = m_x[i] + del_v[0] * lambda;
938  ytemp[i] = m_y[i] + del_v[1] * lambda;
939  ztemp[i] = m_z[i] + del_v[2] * lambda;
940  }
941 
942  // compute second weighted average
943  for(i=0;i< m_nvert;++i)
944  {
945 
946  w = 1.0/(NekDouble)(adj[i].size());
947  del_v[0] = del_v[1] = del_v[2] = 0;
948 
949  for(iad = adj[i].begin(); iad != adj[i].end(); ++iad)
950  {
951  del_v[0] = del_v[0] + (m_x[*iad]-m_x[i])*w;
952  del_v[1] = del_v[1] + (m_y[*iad]-m_y[i])*w;
953  del_v[2] = del_v[2] + (m_z[*iad]-m_z[i])*w;
954  }
955 
956  m_x[i] = xtemp[i] + del_v[0] * mu;
957  m_y[i] = ytemp[i] + del_v[1] * mu;
958  m_z[i] = ztemp[i] + del_v[2] * mu;
959  }
960  }
961 }
vector< NekDouble > m_x
double NekDouble
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
vector< NekDouble > m_z
Array< OneD, int > m_vid
vector< NekDouble > m_y

Member Data Documentation

bool Nektar::Utilities::Iso::m_condensed
private

Definition at line 175 of file ProcessIsoContour.h.

Referenced by condense(), globalcondense(), and Iso().

vector<vector<NekDouble> > Nektar::Utilities::Iso::m_fields
private
int Nektar::Utilities::Iso::m_ntris
private
int Nektar::Utilities::Iso::m_nvert
private
Array<OneD, int> Nektar::Utilities::Iso::m_vid
private
vector<NekDouble> Nektar::Utilities::Iso::m_x
private
vector<NekDouble> Nektar::Utilities::Iso::m_y
private
vector<NekDouble> Nektar::Utilities::Iso::m_z
private