Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Private Attributes | List of all members
Nektar::FieldUtils::Iso Class Reference

#include <ProcessIsoContour.h>

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

Public Member Functions

void Condense (void)
 
void GlobalCondense (vector< boost::shared_ptr< Iso > > &iso, bool verbose)
 
void SeparateRegions (vector< boost::shared_ptr< Iso > > &iso, int minsize, bool verbose)
 
void Smooth (int n_iter, NekDouble lambda, NekDouble mu)
 
int GetNVert (void)
 
void SetNVert (int n)
 
int GetNTris (void)
 
void SetNTris (int n)
 
void SetFields (const int loc, const Array< OneD, Array< OneD, NekDouble > > &intfields, const int j)
 
NekDouble GetFields (const int i, const int j)
 
void SetX (int loc, NekDouble val)
 
void SetY (int loc, NekDouble val)
 
void SetZ (int loc, NekDouble val)
 
NekDouble GetX (int loc)
 
NekDouble GetY (int loc)
 
NekDouble GetZ (int loc)
 
int GetVId (int i)
 
void ResizeVId (int nconn)
 
void SetVId (int i, int j)
 
void ResizeFields (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 58 of file ProcessIsoContour.h.

Constructor & Destructor Documentation

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

Definition at line 167 of file ProcessIsoContour.h.

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

168  {
169  m_condensed = false;
170  m_nvert = 0;
171  m_fields.resize(nfields);
172  // set up initial vectors to be 10000 long
173  m_x.resize(10000);
174  m_y.resize(10000);
175  m_z.resize(10000);
176  for(int i = 0; i < m_fields.size(); ++i)
177  {
178  m_fields[i].resize(10000);
179  }
180  };
vector< vector< NekDouble > > m_fields
vector< NekDouble > m_z
vector< NekDouble > m_x
vector< NekDouble > m_y
Nektar::FieldUtils::Iso::~Iso ( void  )
inline

Definition at line 182 of file ProcessIsoContour.h.

183  {
184  }

Member Function Documentation

void Nektar::FieldUtils::Iso::Condense ( void  )

Definition at line 686 of file ProcessIsoContour.cpp.

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

687 {
688  register int i,j,cnt;
689  IsoVertex v;
690  vector<IsoVertex> vert;
692 
693  if(!m_ntris) return;
694 
695  if(m_condensed) return;
696  m_condensed = true;
697 
698  vert.reserve(m_ntris/6);
699 
700  m_vid = Array<OneD, int>(3*m_ntris);
701 
702  // fill first 3 points and initialise fields
703  v.m_fields.resize(m_fields.size());
704  for(cnt =0, i = 0; i < 3; ++i)
705  {
706  v.m_x = m_x[i];
707  v.m_y = m_y[i];
708  v.m_z = m_z[i];
709  for(int f = 0; f < m_fields.size(); ++f)
710  {
711  v.m_fields[f] = m_fields[f][i];
712  }
713  v.m_id = cnt;
714  vert.push_back(v);
715  m_vid[i] = v.m_id;
716  ++cnt;
717  }
718 
719  for(i = 1; i < m_ntris; ++i)
720  {
721  for(j = 0; j < 3; ++j)
722  {
723  v.m_x = m_x[3*i+j];
724  v.m_y = m_y[3*i+j];
725  v.m_z = m_z[3*i+j];
726 
727  pt = find(vert.begin(),vert.end(),v);
728  if(pt != vert.end())
729  {
730  m_vid[3*i+j] = pt[0].m_id;
731  }
732  else
733  {
734  v.m_id = cnt;
735 
736  for(int f = 0; f < m_fields.size(); ++f)
737  {
738  v.m_fields[f] = m_fields[f][3*i+j];
739  }
740 
741  vert.push_back(v);
742 
743  m_vid[3*i+j] = v.m_id;
744  ++cnt;
745  }
746  }
747  }
748 
749  // remove elements with multiple vertices
750  for(i = 0,cnt=0; i < m_ntris;)
751  {
752  if((m_vid[3*i] ==m_vid[3*i+1])||
753  (m_vid[3*i] ==m_vid[3*i+2])||
754  (m_vid[3*i+1]==m_vid[3*i+2]))
755  {
756  cnt++;
757  for(j = 3*i; j < 3*(m_ntris-1); ++j)
758  {
759  m_vid[j] = m_vid[j+3];
760  }
761  m_ntris--;
762  }
763  else
764  {
765  ++i;
766  }
767  }
768 
769  m_nvert = vert.size();
770 
771  m_x.resize(m_nvert);
772  m_y.resize(m_nvert);
773  m_z.resize(m_nvert);
774 
775  for(int f = 0; f < m_fields.size(); ++f)
776  {
777  m_fields[f].resize(m_nvert);
778  }
779 
780  for(i = 0; i < m_nvert; ++i)
781  {
782  m_x[i] = vert[i].m_x;
783  m_y[i] = vert[i].m_y;
784  m_z[i] = vert[i].m_z;
785  for(int f = 0; f < m_fields.size(); ++f)
786  {
787  m_fields[f][i] = vert[i].m_fields[f];
788  }
789  }
790 }
vector< vector< NekDouble > > m_fields
vector< NekDouble > m_z
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
vector< NekDouble > m_x
Array< OneD, int > m_vid
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
Definition: StdRegions.hpp:316
vector< NekDouble > m_y
NekDouble Nektar::FieldUtils::Iso::GetFields ( const int  i,
const int  j 
)
inline

Definition at line 101 of file ProcessIsoContour.h.

References m_fields.

102  {
103  return m_fields[i][j];
104  }
vector< vector< NekDouble > > m_fields
int Nektar::FieldUtils::Iso::GetNTris ( void  )
inline

Definition at line 77 of file ProcessIsoContour.h.

References m_ntris.

78  {
79  return m_ntris;
80  }
int Nektar::FieldUtils::Iso::GetNVert ( void  )
inline

Definition at line 67 of file ProcessIsoContour.h.

References m_nvert.

68  {
69  return m_nvert;
70  }
int Nektar::FieldUtils::Iso::GetVId ( int  i)
inline

Definition at line 136 of file ProcessIsoContour.h.

References m_vid.

137  {
138  return m_vid[i];
139  }
Array< OneD, int > m_vid
NekDouble Nektar::FieldUtils::Iso::GetX ( int  loc)
inline

Definition at line 121 of file ProcessIsoContour.h.

References m_x.

122  {
123  return m_x[loc];
124  }
vector< NekDouble > m_x
NekDouble Nektar::FieldUtils::Iso::GetY ( int  loc)
inline

Definition at line 126 of file ProcessIsoContour.h.

References m_y.

127  {
128  return m_y[loc];
129  }
vector< NekDouble > m_y
NekDouble Nektar::FieldUtils::Iso::GetZ ( int  loc)
inline

Definition at line 131 of file ProcessIsoContour.h.

References m_z.

132  {
133  return m_z[loc];
134  }
vector< NekDouble > m_z
void Nektar::FieldUtils::Iso::GlobalCondense ( vector< boost::shared_ptr< Iso > > &  iso,
bool  verbose 
)

Definition at line 793 of file ProcessIsoContour.cpp.

References Nektar::iterator, m_condensed, m_fields, m_ntris, m_nvert, m_vid, m_x, m_y, m_z, Nektar::LibUtilities::PrintProgressbar(), and Nektar::FieldUtils::SQ_PNT_TOL.

794 {
795  typedef bg::model::point<NekDouble, 3, bg::cs::cartesian> BPoint;
796  typedef std::pair<BPoint, unsigned int> PointPair;
797 
798  int i,j,n;
799  int nelmt;
800  int niso=iso.size();
801  int id1,id2;
802  Array<OneD, Array<OneD, int> > vidmap;
803 
804  if(m_condensed) return;
805  m_condensed = true;
806 
807  vidmap = Array<OneD, Array<OneD, int> > (niso);
808 
809  m_ntris = 0;
810  for(i = 0; i < niso; ++i)
811  {
812  if(iso[i]->m_ntris)
813  {
814  m_ntris += iso[i]->m_ntris;
815  }
816  }
817 
818  m_vid = Array<OneD, int>(3*m_ntris);
819 
820  m_nvert = 0;
821  for(i = 0; i < niso; ++i)
822  {
823  if(iso[i]->m_ntris)
824  {
825  m_nvert += iso[i]->m_nvert;
826  }
827  }
828 
829  vector< vector<int> > isocon;
830  isocon.resize(niso);
831  vector<int> global_to_unique_map;
832  global_to_unique_map.resize(m_nvert);
833 
834  vector< pair<int,int> > global_to_iso_map;
835  global_to_iso_map.resize(m_nvert);
836 
837  //Fill vertex array into rtree format
838  id2 = 0;
839  std::vector<PointPair> inPoints;
840  for(i = 0; i < niso; ++i)
841  {
842  for(id1 = 0; id1 < iso[i]->m_nvert; ++id1)
843  {
844  inPoints.push_back(PointPair(BPoint( iso[i]->m_x[id1],
845  iso[i]->m_y[id1],
846  iso[i]->m_z[id1]), id2));
847  global_to_unique_map[id2]=id2;
848  global_to_iso_map[id2] = make_pair(i,id1);
849  id2++;
850  }
851  }
852 
853 
854  if(verbose)
855  {
856  cout << "Process building tree ..." << endl;
857  }
858 
859  //Build tree
860  bgi::rtree<PointPair, bgi::rstar<16> > rtree;
861  rtree.insert(inPoints.begin(), inPoints.end());
862 
863  //Find neipghbours
864  int unique_index = 0;
865  int prog=0;
866  for(i = 0; i < m_nvert; ++i)
867  {
868  if(verbose)
869  {
870  prog = LibUtilities::PrintProgressbar(i,m_nvert,
871  "Nearest verts",prog);
872  }
873 
874  BPoint queryPoint = inPoints[i].first;
875 
876 
877  // check to see if point has been already reset to lower than
878  // unique value
879  if(global_to_unique_map[i] < unique_index) // do nothing
880  {
881  }
882  else
883  {
884 
885  // find nearest 10 points within the distance box
886  std::vector<PointPair> result;
887  rtree.query(bgi::nearest(queryPoint, 10), std::back_inserter(result));
888 
889  //see if any values have unique value already
890  set<int> samept;
892  int new_index = -1;
893  for(id1 = 0; id1 < result.size(); ++id1)
894  {
895  NekDouble dist = bg::distance(queryPoint, result[id1].first);
896  if(dist*dist<SQ_PNT_TOL) // same point
897  {
898  id2 = result[id1].second;
899  samept.insert(id2);
900 
901  if(global_to_unique_map[id2] <unique_index)
902  {
903  new_index = global_to_unique_map[id2];
904  }
905  }
906  }
907  if(new_index == -1)
908  {
909  new_index = unique_index;
910  unique_index++;
911  }
912 
913  // reset all same values to new_index
914  global_to_unique_map[i] = new_index;
915  for(it = samept.begin(); it != samept.end(); ++it)
916  {
917  global_to_unique_map[*it] = new_index;
918  }
919  }
920  }
921 
922  if(verbose)
923  {
924  cout << endl;
925  }
926 
927  m_nvert = unique_index;
928 
929  nelmt = 0;
930  // reset m_vid;
931  int cnt = 0;
932  for(n = 0; n < niso; ++n)
933  {
934  for(i = 0; i < iso[n]->m_ntris; ++i,nelmt++)
935  {
936  for(j=0; j < 3;++j)
937  {
938  m_vid[3*nelmt+j] = global_to_unique_map[iso[n]->m_vid[3*i+j]+cnt];
939  }
940  }
941  cnt += iso[n]->m_nvert;
942  }
943 
944  m_ntris = nelmt;
945 
946  m_x.resize(m_nvert);
947  m_y.resize(m_nvert);
948  m_z.resize(m_nvert);
949 
950  m_fields.resize(iso[0]->m_fields.size());
951  for(i = 0; i < iso[0]->m_fields.size(); ++i)
952  {
953  m_fields[i].resize(m_nvert);
954  }
955 
956  for(n = 0; n < global_to_unique_map.size(); ++n)
957  {
958 
959  m_x[global_to_unique_map[n]] = bg::get<0>(inPoints[n].first);
960  m_y[global_to_unique_map[n]] = bg::get<1>(inPoints[n].first);
961  m_z[global_to_unique_map[n]] = bg::get<2>(inPoints[n].first);
962 
963  int isoid = global_to_iso_map[n].first;
964  int ptid = global_to_iso_map[n].second;
965  for(j = 0; j < m_fields.size(); ++j)
966  {
967  m_fields[j][global_to_unique_map[n]] = iso[isoid]->
968  m_fields[j][ptid];
969  }
970  }
971 }
int PrintProgressbar(const int position, const int goal, const string message, int lastprogress=-1)
Prints a progressbar.
Definition: Progressbar.hpp:69
vector< vector< NekDouble > > m_fields
double NekDouble
vector< NekDouble > m_z
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
vector< NekDouble > m_x
Array< OneD, int > m_vid
const NekDouble SQ_PNT_TOL
vector< NekDouble > m_y
void Nektar::FieldUtils::Iso::ResizeFields ( int  size)
inline

Definition at line 151 of file ProcessIsoContour.h.

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

152  {
153  if(size > m_x.size()) // add 1000 element to vectors
154  {
155  m_x.resize(size+100);
156  m_y.resize(size+100);
157  m_z.resize(size+100);;
158  for(int i = 0; i < m_fields.size(); ++i)
159  {
160  m_fields[i].resize(size+1000);
161  }
162 
163  }
164  m_nvert = size;
165  }
vector< vector< NekDouble > > m_fields
vector< NekDouble > m_z
vector< NekDouble > m_x
vector< NekDouble > m_y
void Nektar::FieldUtils::Iso::ResizeVId ( int  nconn)
inline

Definition at line 141 of file ProcessIsoContour.h.

References m_vid.

142  {
143  m_vid = Array<OneD, int>(nconn);
144  }
Array< OneD, int > m_vid
void Nektar::FieldUtils::Iso::SeparateRegions ( vector< boost::shared_ptr< Iso > > &  iso,
int  minsize,
bool  verbose 
)

Definition at line 1094 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, Nektar::LibUtilities::PrintProgressbar(), WARNINGL0, and Vmath::Zero().

1095 {
1096  int i,j,k,id;
1097  Array<OneD, vector<int> >vertcon(m_nvert);
1099  list<int> tocheck;
1100  list<int>::iterator cid;
1101 
1102  Array<OneD, bool> viddone(m_nvert,false);
1103 
1104  // make list of connecting tris around each vertex
1105  for(i = 0; i < m_ntris; ++i)
1106  {
1107  for(j = 0; j < 3; ++j)
1108  {
1109  vertcon[m_vid[3*i+j]].push_back(i);
1110  }
1111  }
1112 
1113  Array<OneD, int> vidregion(m_nvert,-1);
1114 
1115  int nregions = -1;
1116 
1117 
1118  // check all points are assigned to a region
1119  int progcnt = -1;
1120  for(k = 0; k < m_nvert; ++k)
1121  {
1122  if(verbose)
1123  {
1124  progcnt = LibUtilities::PrintProgressbar(k,m_nvert,"Separating regions",progcnt);
1125  }
1126 
1127  if(vidregion[k] == -1)
1128  {
1129  vidregion[k] = ++nregions;
1130 
1131  // find all elmts around this.. vertex that need to be checked
1132  for(ipt = vertcon[k].begin(); ipt != vertcon[k].end(); ++ipt)
1133  {
1134  for(i = 0; i < 3; ++i)
1135  {
1136  if(vidregion[id = m_vid[3*(ipt[0])+i]] == -1)
1137  {
1138  tocheck.push_back(id);
1139  vidregion[id] = nregions;
1140  }
1141  }
1142  }
1143  viddone[k] = 1;
1144 
1145  // check all other neighbouring vertices
1146  while(tocheck.size())
1147  {
1148  cid = tocheck.begin();
1149  while(cid != tocheck.end())
1150  {
1151  if(!viddone[*cid])
1152  {
1153  for(ipt = vertcon[*cid].begin(); ipt != vertcon[*cid].end(); ++ipt)
1154  {
1155  for(i = 0; i < 3; ++i)
1156  {
1157  if(vidregion[id = m_vid[3*(ipt[0])+i]] == -1)
1158  {
1159  tocheck.push_back(id);
1160  vidregion[id] = nregions;
1161  }
1162  }
1163  }
1164  viddone[*cid] = 1;
1165  ++cid;
1166  tocheck.pop_front();
1167  }
1168  }
1169  }
1170  }
1171  }
1172  nregions++;
1173 
1174 
1175  Array<OneD, int> nvert(nregions,0);
1176  Array<OneD, int> nelmt(nregions,0);
1177 
1178  // count nverts
1179  for(i = 0; i < m_nvert; ++i)
1180  {
1181  nvert[vidregion[i]] +=1;
1182  }
1183 
1184  // count nelmts
1185  for(i = 0; i < m_ntris; ++i)
1186  {
1187  nelmt[vidregion[m_vid[3*i]]] +=1;
1188  }
1189 
1190  Array<OneD, int> vidmap(m_nvert);
1191  // generate new list of isocontour
1192  for(int n = 0; n < nregions; ++n)
1193  {
1194  if(nelmt[n] > minsize)
1195  {
1196  int nfields = m_fields.size();
1198 
1199  iso->m_ntris = nelmt[n];
1200  iso->m_vid = Array<OneD, int>(3*nelmt[n]);
1201 
1202  iso->m_nvert = nvert[n];
1203  iso->m_x.resize(nvert[n]);
1204  iso->m_y.resize(nvert[n]);
1205  iso->m_z.resize(nvert[n]);
1206 
1207  iso->m_fields.resize(nfields);
1208  for(i = 0; i < nfields; ++i)
1209  {
1210  iso->m_fields[i].resize(nvert[n]);
1211  }
1212 
1213 
1214  int cnt = 0;
1215  // generate vid map;
1216  Vmath::Zero(m_nvert,vidmap,1);
1217  for(i = 0; i < m_nvert; ++i)
1218  {
1219  if(vidregion[i] == n)
1220  {
1221  vidmap[i] = cnt++;
1222  }
1223  }
1224 
1225  cnt = 0;
1226  for(i = 0; i < m_ntris; ++i)
1227  {
1228  if(vidregion[m_vid[3*i]] == n)
1229  {
1230  for(j = 0; j < 3; ++j)
1231  {
1232  iso->m_vid[3*cnt+j] = vidmap[m_vid[3*i+j]];
1233 
1234  iso->m_x[vidmap[m_vid[3*i+j]]] = m_x[m_vid[3*i+j]];
1235  iso->m_y[vidmap[m_vid[3*i+j]]] = m_y[m_vid[3*i+j]];
1236  iso->m_z[vidmap[m_vid[3*i+j]]] = m_z[m_vid[3*i+j]];
1237 
1238  for(k = 0; k < nfields; ++k)
1239  {
1240  iso->m_fields[k][vidmap[m_vid[3*i+j]]] = m_fields[k][m_vid[3*i+j]];
1241  }
1242  }
1243  cnt++;
1244  }
1245  }
1246 
1247  WARNINGL0(cnt == nelmt[n],"Number of elements do not match");
1248  sep_iso.push_back(iso);
1249  }
1250  }
1251 }
int PrintProgressbar(const int position, const int goal, const string message, int lastprogress=-1)
Prints a progressbar.
Definition: Progressbar.hpp:69
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
vector< vector< NekDouble > > m_fields
boost::shared_ptr< Iso > IsoSharedPtr
#define WARNINGL0(condition, msg)
Definition: ErrorUtil.hpp:204
vector< NekDouble > m_z
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
vector< NekDouble > m_x
Array< OneD, int > m_vid
vector< NekDouble > m_y
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:373
void Nektar::FieldUtils::Iso::SetFields ( const int  loc,
const Array< OneD, Array< OneD, NekDouble > > &  intfields,
const int  j 
)
inline

Definition at line 87 of file ProcessIsoContour.h.

References m_fields, m_x, m_y, and m_z.

90  {
91  m_x[loc] = intfields[0][j];
92  m_y[loc] = intfields[1][j];
93  m_z[loc] = intfields[2][j];
94 
95  for(int i = 0; i < intfields.num_elements()-3; ++i)
96  {
97  m_fields[i][loc] = intfields[i+3][j];
98  }
99  }
vector< vector< NekDouble > > m_fields
vector< NekDouble > m_z
vector< NekDouble > m_x
vector< NekDouble > m_y
void Nektar::FieldUtils::Iso::SetNTris ( int  n)
inline

Definition at line 82 of file ProcessIsoContour.h.

References m_ntris.

83  {
84  m_ntris = n;
85  }
void Nektar::FieldUtils::Iso::SetNVert ( int  n)
inline

Definition at line 72 of file ProcessIsoContour.h.

References m_nvert.

73  {
74  m_nvert = n;
75  }
void Nektar::FieldUtils::Iso::SetVId ( int  i,
int  j 
)
inline

Definition at line 146 of file ProcessIsoContour.h.

References m_vid.

147  {
148  m_vid[i] = j;
149  }
Array< OneD, int > m_vid
void Nektar::FieldUtils::Iso::SetX ( int  loc,
NekDouble  val 
)
inline

Definition at line 106 of file ProcessIsoContour.h.

References m_x.

107  {
108  m_x[loc] = val;
109  }
vector< NekDouble > m_x
void Nektar::FieldUtils::Iso::SetY ( int  loc,
NekDouble  val 
)
inline

Definition at line 111 of file ProcessIsoContour.h.

References m_y.

112  {
113  m_y[loc] = val;
114  }
vector< NekDouble > m_y
void Nektar::FieldUtils::Iso::SetZ ( int  loc,
NekDouble  val 
)
inline

Definition at line 116 of file ProcessIsoContour.h.

References m_z.

117  {
118  m_z[loc] = val;
119  }
vector< NekDouble > m_z
void Nektar::FieldUtils::Iso::Smooth ( int  n_iter,
NekDouble  lambda,
NekDouble  mu 
)

Definition at line 988 of file ProcessIsoContour.cpp.

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

989 {
990  int iter,i,j,k;
991  NekDouble del_v[3];
992  NekDouble w;
993  Array<OneD, NekDouble> xtemp, ytemp, ztemp;
994  vector< vector<int> > adj,vertcon;
995  vector< vector<NekDouble > > wght;
998 
999  // determine elements around each vertex
1000  vertcon.resize(m_nvert);
1001  for(i = 0; i < m_ntris; ++i)
1002  {
1003  for(j = 0; j < 3; ++j)
1004  {
1005  vertcon[m_vid[3*i+j]].push_back(i);
1006  }
1007  }
1008 
1009  // determine vertices and weights around each vertex
1010  adj.resize(m_nvert);
1011  wght.resize(m_nvert);
1012 
1013  for(i =0; i < m_nvert; ++i)
1014  {
1015  // loop over surrounding elements
1016  for(ipt = vertcon[i].begin(); ipt != vertcon[i].end(); ++ipt)
1017  {
1018  for(j = 0; j < 3; ++j)
1019  {
1020  // make sure not adding own vertex
1021  if(m_vid[3*(*ipt)+j] != i)
1022  {
1023  // check to see if vertex has already been added
1024  for(k = 0; k < adj[i].size(); ++k)
1025  {
1026  if(adj[i][k] == m_vid[3*(*ipt)+j])
1027  {
1028  break;
1029  }
1030  }
1031 
1032  if(k == adj[i].size())
1033  {
1034  adj[i].push_back(m_vid[3*(*ipt)+j]);
1035  }
1036  }
1037  }
1038  }
1039  }
1040 
1041  // Currently set weights up as even distribution
1042  for(i =0; i < m_nvert; ++i)
1043  {
1044  w = 1.0/((NekDouble)adj[i].size());
1045  for(j = 0; j < adj[i].size(); ++j)
1046  {
1047  wght[i].push_back(w);
1048  }
1049  }
1050 
1051 
1052  xtemp = Array<OneD, NekDouble>(m_nvert);
1053  ytemp = Array<OneD, NekDouble>(m_nvert);
1054  ztemp = Array<OneD, NekDouble>(m_nvert);
1055 
1056  // smooth each point
1057  for (iter=0;iter<n_iter;iter++)
1058  {
1059  // compute first weighted average
1060  for(i=0;i< m_nvert;++i)
1061  {
1062  del_v[0] = del_v[1] = del_v[2] = 0.0;
1063  for(j = 0; j < adj[i].size(); ++j)
1064  {
1065  del_v[0] = del_v[0] + (m_x[adj[i][j]]-m_x[i])*wght[i][j];
1066  del_v[1] = del_v[1] + (m_y[adj[i][j]]-m_y[i])*wght[i][j];
1067  del_v[2] = del_v[2] + (m_z[adj[i][j]]-m_z[i])*wght[i][j];
1068  }
1069 
1070  xtemp[i] = m_x[i] + del_v[0] * lambda;
1071  ytemp[i] = m_y[i] + del_v[1] * lambda;
1072  ztemp[i] = m_z[i] + del_v[2] * lambda;
1073  }
1074 
1075  // compute second weighted average
1076  for(i=0;i< m_nvert;++i)
1077  {
1078  del_v[0] = del_v[1] = del_v[2] = 0;
1079  for(j = 0; j < adj[i].size(); ++j)
1080  {
1081  del_v[0] = del_v[0] + (xtemp[adj[i][j]]-xtemp[i])*wght[i][j];
1082  del_v[1] = del_v[1] + (ytemp[adj[i][j]]-ytemp[i])*wght[i][j];
1083  del_v[2] = del_v[2] + (ztemp[adj[i][j]]-ztemp[i])*wght[i][j];
1084  }
1085 
1086  m_x[i] = xtemp[i] + del_v[0] * mu;
1087  m_y[i] = ytemp[i] + del_v[1] * mu;
1088  m_z[i] = ztemp[i] + del_v[2] * mu;
1089  }
1090  }
1091 }
double NekDouble
vector< NekDouble > m_z
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
vector< NekDouble > m_x
Array< OneD, int > m_vid
vector< NekDouble > m_y

Member Data Documentation

bool Nektar::FieldUtils::Iso::m_condensed
private

Definition at line 187 of file ProcessIsoContour.h.

Referenced by Condense(), GlobalCondense(), and Iso().

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