Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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, bool verbose)
 
void separate_regions (vector< boost::shared_ptr< Iso > > &iso, int minsize, bool verbose)
 
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 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(10000);
163  m_y.resize(10000);
164  m_z.resize(10000);
165  for(int i = 0; i < m_fields.size(); ++i)
166  {
167  m_fields[i].resize(10000);
168  }
169  };
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 171 of file ProcessIsoContour.h.

172  {
173  }

Member Function Documentation

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

Definition at line 642 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, Nektar::Utilities::IsoVertex::m_z, and Nektar::NekMeshUtils::vert.

643 {
644  register int i,j,cnt;
645  IsoVertex v;
646  vector<IsoVertex> vert;
648 
649  if(!m_ntris) return;
650 
651  if(m_condensed) return;
652  m_condensed = true;
653 
654  vert.reserve(m_ntris/6);
655 
657 
658  // fill first 3 points and initialise fields
659  v.m_fields.resize(m_fields.size());
660  for(cnt =0, i = 0; i < 3; ++i)
661  {
662  v.m_x = m_x[i];
663  v.m_y = m_y[i];
664  v.m_z = m_z[i];
665  for(int f = 0; f < m_fields.size(); ++f)
666  {
667  v.m_fields[f] = m_fields[f][i];
668  }
669  v.m_id = cnt;
670  vert.push_back(v);
671  m_vid[i] = v.m_id;
672  ++cnt;
673  }
674 
675  for(i = 1; i < m_ntris; ++i)
676  {
677  for(j = 0; j < 3; ++j)
678  {
679  v.m_x = m_x[3*i+j];
680  v.m_y = m_y[3*i+j];
681  v.m_z = m_z[3*i+j];
682 
683  pt = find(vert.begin(),vert.end(),v);
684  if(pt != vert.end())
685  {
686  m_vid[3*i+j] = pt[0].m_id;
687  }
688  else
689  {
690  v.m_id = cnt;
691 
692  for(int f = 0; f < m_fields.size(); ++f)
693  {
694  v.m_fields[f] = m_fields[f][3*i+j];
695  }
696 
697  vert.push_back(v);
698 
699  m_vid[3*i+j] = v.m_id;
700  ++cnt;
701  }
702  }
703  }
704 
705  // remove elements with multiple vertices
706  for(i = 0,cnt=0; i < m_ntris;)
707  {
708  if((m_vid[3*i] ==m_vid[3*i+1])||
709  (m_vid[3*i] ==m_vid[3*i+2])||
710  (m_vid[3*i+1]==m_vid[3*i+2]))
711  {
712  cnt++;
713  for(j = 3*i; j < 3*(m_ntris-1); ++j)
714  {
715  m_vid[j] = m_vid[j+3];
716  }
717  m_ntris--;
718  }
719  else
720  {
721  ++i;
722  }
723  }
724 
725  m_nvert = vert.size();
726 
727  m_x.resize(m_nvert);
728  m_y.resize(m_nvert);
729  m_z.resize(m_nvert);
730 
731  for(int f = 0; f < m_fields.size(); ++f)
732  {
733  m_fields[f].resize(m_nvert);
734  }
735 
736  for(i = 0; i < m_nvert; ++i)
737  {
738  m_x[i] = vert[i].m_x;
739  m_y[i] = vert[i].m_y;
740  m_z[i] = vert[i].m_z;
741  for(int f = 0; f < m_fields.size(); ++f)
742  {
743  m_fields[f][i] = vert[i].m_fields[f];
744  }
745  }
746 }
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:315
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 125 of file ProcessIsoContour.h.

References m_vid.

126  {
127  return m_vid[i];
128  }
Array< OneD, int > m_vid
NekDouble Nektar::Utilities::Iso::get_x ( 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::Utilities::Iso::get_y ( 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::Utilities::Iso::get_z ( 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::Utilities::Iso::globalcondense ( vector< boost::shared_ptr< Iso > > &  iso,
bool  verbose 
)

Definition at line 777 of file ProcessIsoContour.cpp.

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

778 {
779  int i,j,n;
780  int nvert,nelmt;
781  int niso=iso.size();
782  int id1,id2;
784 
785  if(m_condensed) return;
786  m_condensed = true;
787 
788  vidmap = Array<OneD, Array<OneD, int> > (niso);
789 
790  m_ntris = 0;
791  for(i = 0; i < niso; ++i)
792  {
793  if(iso[i]->m_ntris)
794  {
795  m_ntris += iso[i]->m_ntris;
796  }
797  }
798 
800 
801  m_nvert = 0;
802  for(i = 0; i < niso; ++i)
803  {
804  if(iso[i]->m_ntris)
805  {
806  m_nvert += iso[i]->m_nvert;
807  }
808  }
809 
810  vector< vector<int> > isocon;
811  isocon.resize(niso);
812 
813  // identify which iso are connected by at least one point;
814  // find min x,y,z and max x,y,z and see if overlap to select
815  // which zones should be connected
816  {
817  vector<Array<OneD, NekDouble> > sph(niso);
818  Array<OneD, NekDouble> rng(6);
819  for(i = 0; i < niso; ++i)
820  {
821  sph[i] = Array<OneD, NekDouble>(4);
822 
823  // find max and min of isocontour
824  rng[0] = rng[3] = iso[i]->m_x[0];
825  rng[1] = rng[4] = iso[i]->m_x[1];
826  rng[2] = rng[5] = iso[i]->m_x[2];
827 
828  for(id1 = 1; id1 < iso[i]->m_nvert;++id1)
829  {
830  rng[0] = min(rng[0],iso[i]->m_x[i]);
831  rng[1] = min(rng[1],iso[i]->m_y[i]);
832  rng[2] = min(rng[2],iso[i]->m_z[i]);
833 
834  rng[3] = max(rng[3],iso[i]->m_x[i]);
835  rng[4] = max(rng[4],iso[i]->m_y[i]);
836  rng[5] = max(rng[5],iso[i]->m_z[i]);
837  }
838 
839  // centroid
840  sph[i][0] = (rng[3]+rng[0])/2.0;
841  sph[i][1] = (rng[4]+rng[1])/2.0;
842  sph[i][2] = (rng[5]+rng[2])/2.0;
843 
844  // radius;
845  sph[i][3] = sqrt((rng[3]-rng[0])*(rng[3]-rng[0]) +
846  (rng[4]-rng[1])*(rng[4]-rng[1]) +
847  (rng[5]-rng[2])*(rng[5]-rng[2]));
848  }
849 
850  for(i = 0; i < niso; ++i)
851  {
852  for(j = i; j < niso; ++j)
853  {
854  NekDouble diff=sqrt((sph[i][0]-sph[j][0])*(sph[i][0]-sph[j][0])+
855  (sph[i][1]-sph[j][1])*(sph[i][1]-sph[j][1])+
856  (sph[i][2]-sph[j][2])*(sph[i][2]-sph[j][2]));
857 
858  // if centroid is closer than added radii
859  if(diff < sph[i][3] + sph[j][3])
860  {
861  isocon[i].push_back(j);
862  }
863  }
864  }
865 
866  }
867 
868 
869  for(i = 0; i < niso; ++i)
870  {
871  vidmap[i] = Array<OneD, int>(iso[i]->m_nvert,-1);
872  }
873  nvert = 0;
874  int cnt = 0;
875  // count up amount of checking to be done
876  NekDouble totiso = 0;
877  for(i = 0; i < niso; ++i)
878  {
879  totiso += isocon[i].size();
880  }
881 
882 
883  if(verbose)
884  {
885  cout << "Progress Bar totiso: " << totiso << endl;
886  }
887  for(i = 0; i < niso; ++i)
888  {
889  for(n = 0; n < isocon[i].size(); ++n, ++cnt)
890  {
891 
892  if(verbose && totiso >= 40)
893  {
894  LibUtilities::PrintProgressbar(cnt,totiso,"Condensing verts");
895  }
896 
897  int con = isocon[i][n];
898  for(id1 = 0; id1 < iso[i]->m_nvert; ++id1)
899  {
900 
901  if(verbose && totiso < 40)
902  {
903  LibUtilities::PrintProgressbar(id1,iso[i]->m_nvert,"isocon");
904  }
905 
906  int start = 0;
907  if(con == i)
908  {
909  start = id1+1;
910  }
911  for(id2 = start; id2 < iso[con]->m_nvert; ++id2)
912  {
913 
914  if((vidmap[con][id2] == -1)||(vidmap[i][id1] == -1))
915  {
916  if(same(iso[i]->m_x[id1], iso[i]->m_y[id1],
917  iso[i]->m_z[id1], iso[con]->m_x[id2],
918  iso[con]->m_y[id2],iso[con]->m_z[id2]))
919  {
920  if((vidmap[i][id1] == -1) &&
921  (vidmap[con][id2] != -1))
922  {
923  vidmap[i][id1] = vidmap[con][id2];
924  }
925  else if((vidmap[con][id2] == -1) &&
926  (vidmap[i][id1] != -1))
927  {
928  vidmap[con][id2] = vidmap[i][id1];
929  }
930  else if((vidmap[con][id2] == -1) &&
931  (vidmap[i][id1] == -1))
932  {
933  vidmap[i][id1] = vidmap[con][id2] = nvert++;
934  }
935  }
936  }
937  }
938  }
939  }
940 
941  for(id1 = 0; id1 < iso[i]->m_nvert;++id1)
942  {
943  if(vidmap[i][id1] == -1)
944  {
945  vidmap[i][id1] = nvert++;
946  }
947  }
948  }
949  m_nvert = nvert;
950 
951  nelmt = 0;
952  // reset m_vid;
953  for(n = 0; n < niso; ++n)
954  {
955  for(i = 0; i < iso[n]->m_ntris; ++i,nelmt++)
956  {
957  for(j=0; j < 3;++j)
958  {
959  m_vid[3*nelmt+j] = vidmap[n][iso[n]->m_vid[3*i+j]];
960  }
961  }
962  }
963 
964  m_ntris = nelmt;
965 
966  m_x.resize(m_nvert);
967  m_y.resize(m_nvert);
968  m_z.resize(m_nvert);
969 
970  m_fields.resize(iso[0]->m_fields.size());
971  for(i = 0; i < iso[0]->m_fields.size(); ++i)
972  {
973  m_fields[i].resize(m_nvert);
974  }
975 
976  // reset coordinate and fields.
977  for(n = 0; n < niso; ++n)
978  {
979  for(i = 0; i < iso[n]->m_nvert; ++i)
980  {
981  m_x[vidmap[n][i]] = iso[n]->m_x[i];
982  m_y[vidmap[n][i]] = iso[n]->m_y[i];
983  m_z[vidmap[n][i]] = iso[n]->m_z[i];
984 
985  for(j = 0; j < m_fields.size(); ++j)
986  {
987  m_fields[j][vidmap[n][i]] = iso[n]->m_fields[j][i];
988  }
989  }
990  }
991  cout << endl;
992 }
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 PrintProgressbar(const int position, const int goal, const string message)
Prints a progressbar.
Definition: Progressbar.hpp:70
void Nektar::Utilities::Iso::resize_fields ( 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< 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 130 of file ProcessIsoContour.h.

References m_vid.

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

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

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

References m_vid.

136  {
137  m_vid[i] = j;
138  }
Array< OneD, int > m_vid
void Nektar::Utilities::Iso::set_x ( 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::Utilities::Iso::set_y ( 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::Utilities::Iso::set_z ( 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::Utilities::Iso::smooth ( int  n_iter,
NekDouble  lambda,
NekDouble  mu 
)

Definition at line 994 of file ProcessIsoContour.cpp.

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

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