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 47 of file ProcessIsoContour.h.

Constructor & Destructor Documentation

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

Definition at line 156 of file ProcessIsoContour.h.

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

157  {
158  m_condensed = false;
159  m_nvert = 0;
160  m_fields.resize(nfields);
161  // set up initial vectors to be 10000 long
162  m_x.resize(1000);
163  m_y.resize(1000);
164  m_z.resize(1000);
165  for(int i = 0; i < m_fields.size(); ++i)
166  {
167  m_fields[i].resize(1000);
168  }
169  };
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 171 of file ProcessIsoContour.h.

172  {
173  }

Member Function Documentation

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

Definition at line 690 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.

691 {
692  register int i,j,cnt;
693  IsoVertex v;
694  vector<IsoVertex> vert;
696 
697  if(!m_ntris) return;
698 
699  if(m_condensed) return;
700  m_condensed = true;
701 
702  vert.reserve(m_ntris/6);
703 
704  m_vid = Array<OneD, int>(3*m_ntris);
705 
706  // fill first 3 points and initialise fields
707  v.m_fields.resize(m_fields.size());
708  for(cnt =0, i = 0; i < 3; ++i)
709  {
710  v.m_x = m_x[i];
711  v.m_y = m_y[i];
712  v.m_z = m_z[i];
713  for(int f = 0; f < m_fields.size(); ++f)
714  {
715  v.m_fields[f] = m_fields[f][i];
716  }
717  v.m_id = cnt;
718  vert.push_back(v);
719  m_vid[i] = v.m_id;
720  ++cnt;
721  }
722 
723  for(i = 1; i < m_ntris; ++i)
724  {
725  for(j = 0; j < 3; ++j)
726  {
727  v.m_x = m_x[3*i+j];
728  v.m_y = m_y[3*i+j];
729  v.m_z = m_z[3*i+j];
730 
731  pt = find(vert.begin(),vert.end(),v);
732  if(pt != vert.end())
733  {
734  m_vid[3*i+j] = pt[0].m_id;
735  }
736  else
737  {
738  v.m_id = cnt;
739 
740  for(int f = 0; f < m_fields.size(); ++f)
741  {
742  v.m_fields[f] = m_fields[f][3*i+j];
743  }
744 
745  vert.push_back(v);
746 
747  m_vid[3*i+j] = v.m_id;
748  ++cnt;
749  }
750  }
751  }
752 
753  // remove elements with multiple vertices
754  for(i = 0,cnt=0; i < m_ntris;)
755  {
756  if((m_vid[3*i] ==m_vid[3*i+1])||
757  (m_vid[3*i] ==m_vid[3*i+2])||
758  (m_vid[3*i+1]==m_vid[3*i+2]))
759  {
760  cnt++;
761  for(j = 3*i; j < 3*(m_ntris-1); ++j)
762  {
763  m_vid[j] = m_vid[j+3];
764  }
765  m_ntris--;
766  }
767  else
768  {
769  ++i;
770  }
771  }
772 
773  m_nvert = vert.size();
774 
775  m_x.resize(m_nvert);
776  m_y.resize(m_nvert);
777  m_z.resize(m_nvert);
778 
779  for(int f = 0; f < m_fields.size(); ++f)
780  {
781  m_fields[f].resize(m_nvert);
782  }
783 
784  for(i = 0; i < m_nvert; ++i)
785  {
786  m_x[i] = vert[i].m_x;
787  m_y[i] = vert[i].m_y;
788  m_z[i] = vert[i].m_z;
789  for(int f = 0; f < m_fields.size(); ++f)
790  {
791  m_fields[f][i] = vert[i].m_fields[f];
792  }
793  }
794 }
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 90 of file ProcessIsoContour.h.

References m_fields.

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

Definition at line 66 of file ProcessIsoContour.h.

References m_ntris.

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

Definition at line 56 of file ProcessIsoContour.h.

References m_nvert.

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

Definition at line 125 of file ProcessIsoContour.h.

References m_vid.

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

Definition at line 110 of file ProcessIsoContour.h.

References m_x.

111  {
112  return m_x[loc];
113  }
vector< NekDouble > m_x
NekDouble Nektar::FieldUtils::Iso::GetY ( int  loc)
inline

Definition at line 115 of file ProcessIsoContour.h.

References m_y.

116  {
117  return m_y[loc];
118  }
vector< NekDouble > m_y
NekDouble Nektar::FieldUtils::Iso::GetZ ( int  loc)
inline

Definition at line 120 of file ProcessIsoContour.h.

References m_z.

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

Definition at line 797 of file ProcessIsoContour.cpp.

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

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

Definition at line 140 of file ProcessIsoContour.h.

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

141  {
142  if(size > m_x.size()) // add 1000 element to vectors
143  {
144  m_x.resize(size+100);
145  m_y.resize(size+100);
146  m_z.resize(size+100);;
147  for(int i = 0; i < m_fields.size(); ++i)
148  {
149  m_fields[i].resize(size+1000);
150  }
151 
152  }
153  m_nvert = size;
154  }
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 130 of file ProcessIsoContour.h.

References m_vid.

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

Definition at line 1098 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().

1099 {
1100  int i,j,k,id;
1101  Array<OneD, vector<int> >vertcon(m_nvert);
1103  list<int> tocheck;
1104  list<int>::iterator cid;
1105 
1106  Array<OneD, bool> viddone(m_nvert,false);
1107 
1108  // make list of connecting tris around each vertex
1109  for(i = 0; i < m_ntris; ++i)
1110  {
1111  for(j = 0; j < 3; ++j)
1112  {
1113  vertcon[m_vid[3*i+j]].push_back(i);
1114  }
1115  }
1116 
1117  Array<OneD, int> vidregion(m_nvert,-1);
1118 
1119  int nregions = -1;
1120 
1121 
1122  // check all points are assigned to a region
1123  int progcnt = -1;
1124  for(k = 0; k < m_nvert; ++k)
1125  {
1126  if(verbose)
1127  {
1128  progcnt = LibUtilities::PrintProgressbar(k,m_nvert,"Separating regions",progcnt);
1129  }
1130 
1131  if(vidregion[k] == -1)
1132  {
1133  vidregion[k] = ++nregions;
1134 
1135  // find all elmts around this.. vertex that need to be checked
1136  for(ipt = vertcon[k].begin(); ipt != vertcon[k].end(); ++ipt)
1137  {
1138  for(i = 0; i < 3; ++i)
1139  {
1140  if(vidregion[id = m_vid[3*(ipt[0])+i]] == -1)
1141  {
1142  tocheck.push_back(id);
1143  vidregion[id] = nregions;
1144  }
1145  }
1146  }
1147  viddone[k] = 1;
1148 
1149  // check all other neighbouring vertices
1150  while(tocheck.size())
1151  {
1152  cid = tocheck.begin();
1153  while(cid != tocheck.end())
1154  {
1155  if(!viddone[*cid])
1156  {
1157  for(ipt = vertcon[*cid].begin(); ipt != vertcon[*cid].end(); ++ipt)
1158  {
1159  for(i = 0; i < 3; ++i)
1160  {
1161  if(vidregion[id = m_vid[3*(ipt[0])+i]] == -1)
1162  {
1163  tocheck.push_back(id);
1164  vidregion[id] = nregions;
1165  }
1166  }
1167  }
1168  viddone[*cid] = 1;
1169  ++cid;
1170  tocheck.pop_front();
1171  }
1172  }
1173  }
1174  }
1175  }
1176  nregions++;
1177 
1178 
1179  Array<OneD, int> nvert(nregions,0);
1180  Array<OneD, int> nelmt(nregions,0);
1181 
1182  // count nverts
1183  for(i = 0; i < m_nvert; ++i)
1184  {
1185  nvert[vidregion[i]] +=1;
1186  }
1187 
1188  // count nelmts
1189  for(i = 0; i < m_ntris; ++i)
1190  {
1191  nelmt[vidregion[m_vid[3*i]]] +=1;
1192  }
1193 
1194  Array<OneD, int> vidmap(m_nvert);
1195  // generate new list of isocontour
1196  for(int n = 0; n < nregions; ++n)
1197  {
1198  if(nelmt[n] > minsize)
1199  {
1200  int nfields = m_fields.size();
1202 
1203  iso->m_ntris = nelmt[n];
1204  iso->m_vid = Array<OneD, int>(3*nelmt[n]);
1205 
1206  iso->m_nvert = nvert[n];
1207  iso->m_x.resize(nvert[n]);
1208  iso->m_y.resize(nvert[n]);
1209  iso->m_z.resize(nvert[n]);
1210 
1211  iso->m_fields.resize(nfields);
1212  for(i = 0; i < nfields; ++i)
1213  {
1214  iso->m_fields[i].resize(nvert[n]);
1215  }
1216 
1217 
1218  int cnt = 0;
1219  // generate vid map;
1220  Vmath::Zero(m_nvert,vidmap,1);
1221  for(i = 0; i < m_nvert; ++i)
1222  {
1223  if(vidregion[i] == n)
1224  {
1225  vidmap[i] = cnt++;
1226  }
1227  }
1228 
1229  cnt = 0;
1230  for(i = 0; i < m_ntris; ++i)
1231  {
1232  if(vidregion[m_vid[3*i]] == n)
1233  {
1234  for(j = 0; j < 3; ++j)
1235  {
1236  iso->m_vid[3*cnt+j] = vidmap[m_vid[3*i+j]];
1237 
1238  iso->m_x[vidmap[m_vid[3*i+j]]] = m_x[m_vid[3*i+j]];
1239  iso->m_y[vidmap[m_vid[3*i+j]]] = m_y[m_vid[3*i+j]];
1240  iso->m_z[vidmap[m_vid[3*i+j]]] = m_z[m_vid[3*i+j]];
1241 
1242  for(k = 0; k < nfields; ++k)
1243  {
1244  iso->m_fields[k][vidmap[m_vid[3*i+j]]] = m_fields[k][m_vid[3*i+j]];
1245  }
1246  }
1247  cnt++;
1248  }
1249  }
1250 
1251  WARNINGL0(cnt == nelmt[n],"Number of elements do not match");
1252  sep_iso.push_back(iso);
1253  }
1254  }
1255 }
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 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< 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 71 of file ProcessIsoContour.h.

References m_ntris.

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

Definition at line 61 of file ProcessIsoContour.h.

References m_nvert.

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

Definition at line 135 of file ProcessIsoContour.h.

References m_vid.

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

Definition at line 95 of file ProcessIsoContour.h.

References m_x.

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

Definition at line 100 of file ProcessIsoContour.h.

References m_y.

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

Definition at line 105 of file ProcessIsoContour.h.

References m_z.

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

Definition at line 992 of file ProcessIsoContour.cpp.

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

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