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

#include <ProcessIsoContour.h>

Public Member Functions

void Condense (void)
 
void GlobalCondense (std::vector< std::shared_ptr< Iso >> &iso, bool verbose)
 
void SeparateRegions (std::vector< std::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
 
std::vector< NekDoublem_x
 
std::vector< NekDoublem_y
 
std::vector< NekDoublem_z
 
std::vector< std::vector< NekDouble > > m_fields
 
Array< OneD, int > m_vid
 

Detailed Description

Definition at line 46 of file ProcessIsoContour.h.

Constructor & Destructor Documentation

◆ Iso()

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

Definition at line 156 of file ProcessIsoContour.h.

157  {
158  m_condensed = false;
159  m_nvert = 0;
160  m_fields.resize(nfields);
161  // set up initial vectors to be 1000 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  };
std::vector< NekDouble > m_z
std::vector< std::vector< NekDouble > > m_fields
std::vector< NekDouble > m_y
std::vector< NekDouble > m_x

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

◆ ~Iso()

Nektar::FieldUtils::Iso::~Iso ( void  )
inline

Definition at line 171 of file ProcessIsoContour.h.

172  {
173  }

Member Function Documentation

◆ Condense()

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

Definition at line 663 of file ProcessIsoContour.cpp.

664 {
665  int i, j, cnt;
666  IsoVertex v;
667  vector<IsoVertex> vert;
668 
669  if (!m_ntris)
670  return;
671 
672  if (m_condensed)
673  return;
674  m_condensed = true;
675 
676  vert.reserve(m_ntris / 6);
677 
678  m_vid = Array<OneD, int>(3 * m_ntris);
679 
680  // fill first 3 points and initialise fields
681  v.m_fields.resize(m_fields.size());
682  for (cnt = 0, i = 0; i < 3; ++i)
683  {
684  v.m_x = m_x[i];
685  v.m_y = m_y[i];
686  v.m_z = m_z[i];
687  for (int f = 0; f < m_fields.size(); ++f)
688  {
689  v.m_fields[f] = m_fields[f][i];
690  }
691  v.m_id = cnt;
692  vert.push_back(v);
693  m_vid[i] = v.m_id;
694  ++cnt;
695  }
696 
697  for (i = 1; i < m_ntris; ++i)
698  {
699  for (j = 0; j < 3; ++j)
700  {
701  v.m_x = m_x[3 * i + j];
702  v.m_y = m_y[3 * i + j];
703  v.m_z = m_z[3 * i + j];
704 
705  auto pt = find(vert.begin(), vert.end(), v);
706  if (pt != vert.end())
707  {
708  m_vid[3 * i + j] = pt[0].m_id;
709  }
710  else
711  {
712  v.m_id = cnt;
713 
714  for (int f = 0; f < m_fields.size(); ++f)
715  {
716  v.m_fields[f] = m_fields[f][3 * i + j];
717  }
718 
719  vert.push_back(v);
720 
721  m_vid[3 * i + j] = v.m_id;
722  ++cnt;
723  }
724  }
725  }
726 
727  // remove elements with multiple vertices
728  for (i = 0, cnt = 0; i < m_ntris;)
729  {
730  if ((m_vid[3 * i] == m_vid[3 * i + 1]) ||
731  (m_vid[3 * i] == m_vid[3 * i + 2]) ||
732  (m_vid[3 * i + 1] == m_vid[3 * i + 2]))
733  {
734  cnt++;
735  for (j = 3 * i; j < 3 * (m_ntris - 1); ++j)
736  {
737  m_vid[j] = m_vid[j + 3];
738  }
739  m_ntris--;
740  }
741  else
742  {
743  ++i;
744  }
745  }
746 
747  m_nvert = vert.size();
748 
749  m_x.resize(m_nvert);
750  m_y.resize(m_nvert);
751  m_z.resize(m_nvert);
752 
753  for (int f = 0; f < m_fields.size(); ++f)
754  {
755  m_fields[f].resize(m_nvert);
756  }
757 
758  for (i = 0; i < m_nvert; ++i)
759  {
760  m_x[i] = vert[i].m_x;
761  m_y[i] = vert[i].m_y;
762  m_z[i] = vert[i].m_z;
763  for (int f = 0; f < m_fields.size(); ++f)
764  {
765  m_fields[f][i] = vert[i].m_fields[f];
766  }
767  }
768 }
Array< OneD, int > m_vid
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
Definition: StdRegions.hpp:444

References Nektar::StdRegions::find(), 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.

◆ GetFields()

NekDouble Nektar::FieldUtils::Iso::GetFields ( const int  i,
const int  j 
)
inline

Definition at line 90 of file ProcessIsoContour.h.

91  {
92  return m_fields[i][j];
93  }

References m_fields.

◆ GetNTris()

int Nektar::FieldUtils::Iso::GetNTris ( void  )
inline

Definition at line 66 of file ProcessIsoContour.h.

67  {
68  return m_ntris;
69  }

References m_ntris.

◆ GetNVert()

int Nektar::FieldUtils::Iso::GetNVert ( void  )
inline

Definition at line 56 of file ProcessIsoContour.h.

57  {
58  return m_nvert;
59  }

References m_nvert.

◆ GetVId()

int Nektar::FieldUtils::Iso::GetVId ( int  i)
inline

Definition at line 125 of file ProcessIsoContour.h.

126  {
127  return m_vid[i];
128  }

References m_vid.

◆ GetX()

NekDouble Nektar::FieldUtils::Iso::GetX ( int  loc)
inline

Definition at line 110 of file ProcessIsoContour.h.

111  {
112  return m_x[loc];
113  }

References CG_Iterations::loc, and m_x.

◆ GetY()

NekDouble Nektar::FieldUtils::Iso::GetY ( int  loc)
inline

Definition at line 115 of file ProcessIsoContour.h.

116  {
117  return m_y[loc];
118  }

References CG_Iterations::loc, and m_y.

◆ GetZ()

NekDouble Nektar::FieldUtils::Iso::GetZ ( int  loc)
inline

Definition at line 120 of file ProcessIsoContour.h.

121  {
122  return m_z[loc];
123  }

References CG_Iterations::loc, and m_z.

◆ GlobalCondense()

void Nektar::FieldUtils::Iso::GlobalCondense ( std::vector< std::shared_ptr< Iso >> &  iso,
bool  verbose 
)

Definition at line 770 of file ProcessIsoContour.cpp.

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

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

◆ ResizeFields()

void Nektar::FieldUtils::Iso::ResizeFields ( int  size)
inline

Definition at line 140 of file ProcessIsoContour.h.

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  ;
148  for (int i = 0; i < m_fields.size(); ++i)
149  {
150  m_fields[i].resize(size + 1000);
151  }
152  }
153  m_nvert = size;
154  }

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

◆ ResizeVId()

void Nektar::FieldUtils::Iso::ResizeVId ( int  nconn)
inline

Definition at line 130 of file ProcessIsoContour.h.

131  {
132  m_vid = Array<OneD, int>(nconn);
133  }

References m_vid.

◆ SeparateRegions()

void Nektar::FieldUtils::Iso::SeparateRegions ( std::vector< std::shared_ptr< Iso >> &  iso,
int  minsize,
bool  verbose 
)

Definition at line 1076 of file ProcessIsoContour.cpp.

1078 {
1079  int i, j, k, id;
1080  Array<OneD, vector<int>> vertcon(m_nvert);
1081  list<int> tocheck;
1082 
1083  Array<OneD, bool> viddone(m_nvert, false);
1084 
1085  // make list of connecting tris around each vertex
1086  for (i = 0; i < m_ntris; ++i)
1087  {
1088  for (j = 0; j < 3; ++j)
1089  {
1090  vertcon[m_vid[3 * i + j]].push_back(i);
1091  }
1092  }
1093 
1094  Array<OneD, int> vidregion(m_nvert, -1);
1095 
1096  int nregions = -1;
1097 
1098  // check all points are assigned to a region
1099  int progcnt = -1;
1100  for (k = 0; k < m_nvert; ++k)
1101  {
1102  if (verbose)
1103  {
1105  k, m_nvert, "Separating regions", progcnt);
1106  }
1107 
1108  if (vidregion[k] == -1)
1109  {
1110  vidregion[k] = ++nregions;
1111 
1112  // find all elmts around this.. vertex that need to be checked
1113  for (auto &ipt : vertcon[k])
1114  {
1115  for (i = 0; i < 3; ++i)
1116  {
1117  if (vidregion[id = m_vid[3 * ipt + i]] == -1)
1118  {
1119  tocheck.push_back(id);
1120  vidregion[id] = nregions;
1121  }
1122  }
1123  }
1124  viddone[k] = 1;
1125 
1126  // check all other neighbouring vertices
1127  while (tocheck.size())
1128  {
1129  auto cid = tocheck.begin();
1130  while (cid != tocheck.end())
1131  {
1132  if (!viddone[*cid])
1133  {
1134  for (auto &ipt : vertcon[*cid])
1135  {
1136  for (i = 0; i < 3; ++i)
1137  {
1138  if (vidregion[id = m_vid[3 * ipt + i]] == -1)
1139  {
1140  tocheck.push_back(id);
1141  vidregion[id] = nregions;
1142  }
1143  }
1144  }
1145  viddone[*cid] = 1;
1146  ++cid;
1147  tocheck.pop_front();
1148  }
1149  }
1150  }
1151  }
1152  }
1153  nregions++;
1154 
1155  Array<OneD, int> nvert(nregions, 0);
1156  Array<OneD, int> nelmt(nregions, 0);
1157 
1158  // count nverts
1159  for (i = 0; i < m_nvert; ++i)
1160  {
1161  nvert[vidregion[i]] += 1;
1162  }
1163 
1164  // count nelmts
1165  for (i = 0; i < m_ntris; ++i)
1166  {
1167  nelmt[vidregion[m_vid[3 * i]]] += 1;
1168  }
1169 
1170  Array<OneD, int> vidmap(m_nvert);
1171  // generate new list of isocontour
1172  for (int n = 0; n < nregions; ++n)
1173  {
1174  if (nelmt[n] > minsize)
1175  {
1176  int nfields = m_fields.size();
1178 
1179  iso->m_ntris = nelmt[n];
1180  iso->m_vid = Array<OneD, int>(3 * nelmt[n]);
1181 
1182  iso->m_nvert = nvert[n];
1183  iso->m_x.resize(nvert[n]);
1184  iso->m_y.resize(nvert[n]);
1185  iso->m_z.resize(nvert[n]);
1186 
1187  iso->m_fields.resize(nfields);
1188  for (i = 0; i < nfields; ++i)
1189  {
1190  iso->m_fields[i].resize(nvert[n]);
1191  }
1192 
1193  int cnt = 0;
1194  // generate vid map;
1195  Vmath::Zero(m_nvert, vidmap, 1);
1196  for (i = 0; i < m_nvert; ++i)
1197  {
1198  if (vidregion[i] == n)
1199  {
1200  vidmap[i] = cnt++;
1201  }
1202  }
1203 
1204  cnt = 0;
1205  for (i = 0; i < m_ntris; ++i)
1206  {
1207  if (vidregion[m_vid[3 * i]] == n)
1208  {
1209  for (j = 0; j < 3; ++j)
1210  {
1211  iso->m_vid[3 * cnt + j] = vidmap[m_vid[3 * i + j]];
1212 
1213  iso->m_x[vidmap[m_vid[3 * i + j]]] =
1214  m_x[m_vid[3 * i + j]];
1215  iso->m_y[vidmap[m_vid[3 * i + j]]] =
1216  m_y[m_vid[3 * i + j]];
1217  iso->m_z[vidmap[m_vid[3 * i + j]]] =
1218  m_z[m_vid[3 * i + j]];
1219 
1220  for (k = 0; k < nfields; ++k)
1221  {
1222  iso->m_fields[k][vidmap[m_vid[3 * i + j]]] =
1223  m_fields[k][m_vid[3 * i + j]];
1224  }
1225  }
1226  cnt++;
1227  }
1228  }
1229 
1230  WARNINGL0(cnt == nelmt[n], "Number of elements do not match");
1231  sep_iso.push_back(iso);
1232  }
1233  }
1234 }
#define WARNINGL0(condition, msg)
Definition: ErrorUtil.hpp:222
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< Iso > IsoSharedPtr
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:492

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

◆ SetFields()

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.

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.size() - 3; ++i)
85  {
86  m_fields[i][loc] = intfields[i + 3][j];
87  }
88  }

References CG_Iterations::loc, m_fields, m_x, m_y, and m_z.

◆ SetNTris()

void Nektar::FieldUtils::Iso::SetNTris ( int  n)
inline

Definition at line 71 of file ProcessIsoContour.h.

72  {
73  m_ntris = n;
74  }

References m_ntris.

◆ SetNVert()

void Nektar::FieldUtils::Iso::SetNVert ( int  n)
inline

Definition at line 61 of file ProcessIsoContour.h.

62  {
63  m_nvert = n;
64  }

References m_nvert.

◆ SetVId()

void Nektar::FieldUtils::Iso::SetVId ( int  i,
int  j 
)
inline

Definition at line 135 of file ProcessIsoContour.h.

136  {
137  m_vid[i] = j;
138  }

References m_vid.

◆ SetX()

void Nektar::FieldUtils::Iso::SetX ( int  loc,
NekDouble  val 
)
inline

Definition at line 95 of file ProcessIsoContour.h.

96  {
97  m_x[loc] = val;
98  }

References CG_Iterations::loc, and m_x.

◆ SetY()

void Nektar::FieldUtils::Iso::SetY ( int  loc,
NekDouble  val 
)
inline

Definition at line 100 of file ProcessIsoContour.h.

101  {
102  m_y[loc] = val;
103  }

References CG_Iterations::loc, and m_y.

◆ SetZ()

void Nektar::FieldUtils::Iso::SetZ ( int  loc,
NekDouble  val 
)
inline

Definition at line 105 of file ProcessIsoContour.h.

106  {
107  m_z[loc] = val;
108  }

References CG_Iterations::loc, and m_z.

◆ Smooth()

void Nektar::FieldUtils::Iso::Smooth ( int  n_iter,
NekDouble  lambda,
NekDouble  mu 
)

Definition at line 971 of file ProcessIsoContour.cpp.

972 {
973  int iter, i, j, k;
974  NekDouble del_v[3];
975  NekDouble w;
976  Array<OneD, NekDouble> xtemp, ytemp, ztemp;
977  vector<vector<int>> adj, vertcon;
978  vector<vector<NekDouble>> wght;
979 
980  // determine elements around each vertex
981  vertcon.resize(m_nvert);
982  for (i = 0; i < m_ntris; ++i)
983  {
984  for (j = 0; j < 3; ++j)
985  {
986  vertcon[m_vid[3 * i + j]].push_back(i);
987  }
988  }
989 
990  // determine vertices and weights around each vertex
991  adj.resize(m_nvert);
992  wght.resize(m_nvert);
993 
994  for (i = 0; i < m_nvert; ++i)
995  {
996  // loop over surrounding elements
997  for (auto &ipt : vertcon[i])
998  {
999  for (j = 0; j < 3; ++j)
1000  {
1001  // make sure not adding own vertex
1002  if (m_vid[3 * ipt + j] != i)
1003  {
1004  // check to see if vertex has already been added
1005  for (k = 0; k < adj[i].size(); ++k)
1006  {
1007  if (adj[i][k] == m_vid[3 * ipt + j])
1008  {
1009  break;
1010  }
1011  }
1012 
1013  if (k == adj[i].size())
1014  {
1015  adj[i].push_back(m_vid[3 * ipt + j]);
1016  }
1017  }
1018  }
1019  }
1020  }
1021 
1022  // Currently set weights up as even distribution
1023  for (i = 0; i < m_nvert; ++i)
1024  {
1025  w = 1.0 / ((NekDouble)adj[i].size());
1026  for (j = 0; j < adj[i].size(); ++j)
1027  {
1028  wght[i].push_back(w);
1029  }
1030  }
1031 
1032  xtemp = Array<OneD, NekDouble>(m_nvert);
1033  ytemp = Array<OneD, NekDouble>(m_nvert);
1034  ztemp = Array<OneD, NekDouble>(m_nvert);
1035 
1036  // smooth each point
1037  for (iter = 0; iter < n_iter; iter++)
1038  {
1039  // compute first weighted average
1040  for (i = 0; i < m_nvert; ++i)
1041  {
1042  del_v[0] = del_v[1] = del_v[2] = 0.0;
1043  for (j = 0; j < adj[i].size(); ++j)
1044  {
1045  del_v[0] = del_v[0] + (m_x[adj[i][j]] - m_x[i]) * wght[i][j];
1046  del_v[1] = del_v[1] + (m_y[adj[i][j]] - m_y[i]) * wght[i][j];
1047  del_v[2] = del_v[2] + (m_z[adj[i][j]] - m_z[i]) * wght[i][j];
1048  }
1049 
1050  xtemp[i] = m_x[i] + del_v[0] * lambda;
1051  ytemp[i] = m_y[i] + del_v[1] * lambda;
1052  ztemp[i] = m_z[i] + del_v[2] * lambda;
1053  }
1054 
1055  // compute second weighted average
1056  for (i = 0; i < m_nvert; ++i)
1057  {
1058  del_v[0] = del_v[1] = del_v[2] = 0;
1059  for (j = 0; j < adj[i].size(); ++j)
1060  {
1061  del_v[0] =
1062  del_v[0] + (xtemp[adj[i][j]] - xtemp[i]) * wght[i][j];
1063  del_v[1] =
1064  del_v[1] + (ytemp[adj[i][j]] - ytemp[i]) * wght[i][j];
1065  del_v[2] =
1066  del_v[2] + (ztemp[adj[i][j]] - ztemp[i]) * wght[i][j];
1067  }
1068 
1069  m_x[i] = xtemp[i] + del_v[0] * mu;
1070  m_y[i] = ytemp[i] + del_v[1] * mu;
1071  m_z[i] = ztemp[i] + del_v[2] * mu;
1072  }
1073  }
1074 }

References m_ntris, m_nvert, m_vid, m_x, m_y, and m_z.

Member Data Documentation

◆ m_condensed

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

Definition at line 176 of file ProcessIsoContour.h.

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

◆ m_fields

std::vector<std::vector<NekDouble> > Nektar::FieldUtils::Iso::m_fields
private

◆ m_ntris

int Nektar::FieldUtils::Iso::m_ntris
private

◆ m_nvert

int Nektar::FieldUtils::Iso::m_nvert
private

◆ m_vid

Array<OneD, int> Nektar::FieldUtils::Iso::m_vid
private

◆ m_x

std::vector<NekDouble> Nektar::FieldUtils::Iso::m_x
private

◆ m_y

std::vector<NekDouble> Nektar::FieldUtils::Iso::m_y
private

◆ m_z

std::vector<NekDouble> Nektar::FieldUtils::Iso::m_z
private