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 624 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.

625 {
626  register int i,j,cnt;
627  IsoVertex v;
628  vector<IsoVertex> vert;
630 
631  if(!m_ntris) return;
632 
633  if(m_condensed) return;
634  m_condensed = true;
635 
636  vert.reserve(m_ntris/6);
637 
638  m_vid = Array<OneD, int>(3*m_ntris);
639 
640  // fill first 3 points and initialise fields
641  v.m_fields.resize(m_fields.size());
642  for(cnt =0, i = 0; i < 3; ++i)
643  {
644  v.m_x = m_x[i];
645  v.m_y = m_y[i];
646  v.m_z = m_z[i];
647  for(int f = 0; f < m_fields.size(); ++f)
648  {
649  v.m_fields[f] = m_fields[f][i];
650  }
651  v.m_id = cnt;
652  vert.push_back(v);
653  m_vid[i] = v.m_id;
654  ++cnt;
655  }
656 
657  for(i = 1; i < m_ntris; ++i)
658  {
659  for(j = 0; j < 3; ++j)
660  {
661  v.m_x = m_x[3*i+j];
662  v.m_y = m_y[3*i+j];
663  v.m_z = m_z[3*i+j];
664 
665  pt = find(vert.begin(),vert.end(),v);
666  if(pt != vert.end())
667  {
668  m_vid[3*i+j] = pt[0].m_id;
669  }
670  else
671  {
672  v.m_id = cnt;
673 
674  for(int f = 0; f < m_fields.size(); ++f)
675  {
676  v.m_fields[f] = m_fields[f][3*i+j];
677  }
678 
679  vert.push_back(v);
680 
681  m_vid[3*i+j] = v.m_id;
682  ++cnt;
683  }
684  }
685  }
686 
687  // remove elements with multiple vertices
688  for(i = 0,cnt=0; i < m_ntris;)
689  {
690  if((m_vid[3*i] ==m_vid[3*i+1])||
691  (m_vid[3*i] ==m_vid[3*i+2])||
692  (m_vid[3*i+1]==m_vid[3*i+2]))
693  {
694  cnt++;
695  for(j = 3*i; j < 3*(m_ntris-1); ++j)
696  {
697  m_vid[j] = m_vid[j+3];
698  }
699  m_ntris--;
700  }
701  else
702  {
703  ++i;
704  }
705  }
706 
707  m_nvert = vert.size();
708 
709  m_x.resize(m_nvert);
710  m_y.resize(m_nvert);
711  m_z.resize(m_nvert);
712 
713  for(int f = 0; f < m_fields.size(); ++f)
714  {
715  m_fields[f].resize(m_nvert);
716  }
717 
718  for(i = 0; i < m_nvert; ++i)
719  {
720  m_x[i] = vert[i].m_x;
721  m_y[i] = vert[i].m_y;
722  m_z[i] = vert[i].m_z;
723  for(int f = 0; f < m_fields.size(); ++f)
724  {
725  m_fields[f][i] = vert[i].m_fields[f];
726  }
727  }
728 }
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 759 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().

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

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

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

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