MeshKit  1.0
SurfProHarmonicMap.hpp
Go to the documentation of this file.
00001 #ifndef __SURFPROHARMONICMAP_HPP
00002 #define __SURFPROHARMONICMAP_HPP
00003 
00004 #include <stdlib.h>
00005 #include <stdio.h>
00006 #include <assert.h>
00007 #include <string>
00008 #include <iostream>
00009 #include <fstream>
00010 #include <string.h>
00011 #include <limits.h>
00012 
00013 #include "meshkit/MKCore.hpp"
00014 #include "meshkit/iMesh.hpp"
00015 #include "meshkit/iGeom.hpp"
00016 #include "meshkit/iRel.hpp"
00017 #include "meshkit/MeshOp.hpp"
00018 #include "meshkit/ModelEnt.hpp"
00019 #include "meshkit/SimpleArray.hpp"
00020 #include "Global.hpp"
00021 #include "HarmonicMapper.hpp"
00022 #include <set>
00023 #include <vector>
00024 #include <map>
00025 
00026 
00027 using namespace std;
00028 
00029 namespace MeshKit {
00030 
00031 class SurfProHarmonicMap
00032 {       
00033 public:
00034         //public function
00035         SurfProHarmonicMap(MKCore* core, iBase_EntityHandle s, iBase_EntityHandle t, iBase_EntityHandle v);
00036         ~SurfProHarmonicMap();
00037         void match();
00038         void projection();
00039         void setMeshData(vector<Vertex> &s, vector<Vertex> &t, vector<Face> &f);
00040         void getMeshData(vector<Vertex> &v);
00041 private:
00042         void preprocessing();
00043         void addFaceToList(iBase_EntityHandle entity, Face& f, int index, bool is_set_int);
00044         void GetGeomLoops(Face surf, vector<vector<int> > &loops_vertex, vector<vector<int> > &loops_edge);
00045         void postProcessGeomLoops(Face& surf);
00046         void getFacets();
00047         void MapFacetGeom(Face f_surf, vector<Vertex> facet_node, std::map<int, int> &map_data, vector<list<int> > &geom_facet, int size_facet_v);
00048         //boundary distribution of the outmost boundary on the unit disk
00049         void boundaryDistribution();
00050         //distribute facet vertices of outmost boundary on an unit disk
00051         void boundaryUnitDisk(Face f, vector<double> dist, vector<Vertex> &facet_v, std::vector<std::list<int> > geom_facet);
00052     //establish the correspondence of boundary vertices on the outmost boundary
00053     void LocateBoundaryNodesTarget(); 
00054         //Distribute the interior nodes on the unit disk
00055         void test();
00056         //compute the weight for each edge
00057         void ComputeWeight();
00058         //add the facet edge to the list
00059         void addEdgeToList(int a, int b, int &count, vector<set<int> > &edge_connect, vector<Edge> &f_edges, vector<Vertex> &facet_v);
00060         //compute the edge weight
00061         void computeEdgeWeight(vector<Edge> &f_edges, vector<Face> &f, vector<Vertex> f_v);
00062         //add extra stuff to the facet mesh
00063         void addExtra(Face f, vector<Vertex> &facet_v, vector<Edge> &facet_e, vector<Face> &facet_tri, vector<list<int> > geom_facet, int size_facet_v);
00064         //find a specific triangle where a point is located
00065         int findFacetTri(vector<Face> &facet_tri, vector<Vector3D> nrml, Vector3D xyz, Vector3D &uvw);
00066         int findFacetTri(vector<Face> &facet_tri, Vector2D uv, Vector3D &uvw);
00067         void prjPtsToTri(Face tri, Vector3D pts, Vector3D nrml, Vector3D &xyz);
00068         bool ComputeBarycentric(Vector3D a, Vector3D b, Vector3D c, Vector3D xyz, Vector3D &uvw);
00069         bool ComputeBarycentric(Vector2D a, Vector2D b, Vector2D c, Vector2D xy, Vector3D &uvw);
00070         void computeNormalTri(Face &tri, Vector3D& nrml, Face surf);
00071         void cleanup();
00072         void adjustVtxEdges(Face &f);
00073 private:
00074         //member variables
00075         MKCore* mk_core;
00076 
00077         Face source;
00078         Face target;
00079     iBase_EntityHandle volume;
00080         vector<Face> link;
00081         vector<Edge> edges;
00082         vector<Vertex> vertices;
00083         iGeom *igeom_instance;
00084         iMesh *imesh_instance;
00085         iRel *irel_instance;
00086         iRel::PairHandle *irel_pair;
00087         iBase_TagHandle global_geom_tag;
00088         iBase_TagHandle global_mesh_tag;
00089         iBase_TagHandle harmonic_surf_pro, facet_mesh_tag;
00090         iGeom::Error g_err;
00091         iMesh::Error m_err;
00092         iRel::Error r_err;
00093         vector<Vertex> src_facet_v;
00094         vector<Vertex> tgt_facet_v;
00095         vector<Face> src_facet_tri;
00096         vector<Face> tgt_facet_tri;
00097         vector<Edge> src_facet_e;
00098         vector<Edge> tgt_facet_e;
00099         vector<set<int> > adj_src, adj_tgt;
00100         int size_src_v, size_src_e, size_src_f;
00101         int size_tgt_v, size_tgt_e, size_tgt_f;
00102         //map between geometry and facet
00103         std::map<int, int> src_facet_geom, tgt_facet_geom;
00104         std::vector<std::list<int> > src_geom_facet, tgt_geom_facet;
00105 
00106         vector<Vertex> quad_mesh_src, quad_mesh_tgt;
00107         
00108         vector<Face> facelist;
00109         
00110 };
00111 
00112 }
00113 #endif
00114 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines