cgma
FBStructs.hpp
Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Copyright (C) 2004 Sandia Corporation.  Under the terms of Contract DE-AC04-94AL85000
00005  * with Sandia Corporation, the U.S. Government retains certain rights in this software.
00006  *
00007  * This file is part of facetbool--contact via [email protected]
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2.1 of the License, or (at your option) any later version.
00013  *
00014  * This library is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * Lesser General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public
00020  * License along with this library; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022  *
00023  *
00024  *
00025  */
00026 
00027 #ifndef _FBSTRUCTS
00028 #define _FBSTRUCTS
00029 #include <vector>
00030 #include <list>
00031 #include "CubitDefines.h"
00032 #include "FBDefines.hpp"
00033 
00034 class FSBoundingBox {
00035 public:
00036   FSBoundingBox() { }
00037   FSBoundingBox(float xmi, float ymi, float zmi, float xma, float yma, float zma)
00038   {
00039     xmin = xmi; xmax = xma; ymin = ymi; ymax = yma; zmin = zmi; zmax = zma;
00040   }
00041   ~FSBoundingBox() { }
00042   float  xmin, xmax, ymin, ymax, zmin, zmax;
00043 };
00044 
00045 typedef std::vector<FSBoundingBox* > FSBOXVECTOR;
00046 
00047 class FB_Coord {
00048 
00049 public:
00050    FB_Coord(double x, double y, double z) {
00051      coord[0] = x; coord[1] = y; coord[2] = z;
00052      is_on_boundary = false;
00053    }
00054    ~FB_Coord() {  }
00055    double coord[3];
00056    bool is_on_boundary;
00057 
00058 private:
00059 
00060 };
00061 
00062 class FB_Edge {
00063 
00064 public:
00065    FB_Edge(int vert0, int vert1, int vert0_type, int vert1_type, bool is_intersection) {
00066      v0 = vert0; v1 = vert1;
00067      v0_type = vert0_type; v1_type = vert1_type;
00068      mark = false;
00069      num_times = 0;
00070      slope = 0.0;
00071      quadrant = 0;
00072      if ( is_intersection == true ) 
00073        edge_type = INTERSECTION_EDGE;
00074      else 
00075        edge_type = UNKNOWN;
00076      is_intersection_edge = is_intersection;
00077      cubitedgeindex = 0;
00078    }
00079    FB_Edge();
00080    ~FB_Edge() {  }
00081    int v0, v1;
00082    int v0_type, v1_type;
00083    int edge_type;
00084    bool mark;
00085    bool is_intersection_edge;
00086    int num_times;
00087    double slope;       
00088    unsigned int quadrant;
00089    int cubitedgeindex;
00090   
00091       
00092   
00093   
00094       
00095 };
00096 
00097 class FB_Triangle {
00098 
00099 public:
00100    FB_Triangle(int vert0, int vert1, int vert2, int myparent, int csvalue,
00101                int c0value, int c1value, int c2value) {
00102      v0 = vert0; v1 = vert1; v2 = vert2;
00103      dudded = false;
00104      parent = myparent;
00105      cubitsurfaceindex = csvalue;
00106      cubitedge0index = c0value;
00107      cubitedge1index = c1value;
00108      cubitedge2index = c2value;
00109    }
00110    FB_Triangle();
00111    ~FB_Triangle() {
00112      for(size_t i = 0; i < edge_list.size(); i++)
00113      {
00114        delete edge_list[i];
00115      }
00116 
00117    }
00119   bool are_fb_coords_in_fb_triangle(int fb_vert_index_1,
00120                                     int fb_vert_index_2)
00121     {
00122       if((fb_vert_index_1 == v0 || fb_vert_index_1 == v1 ||
00123           fb_vert_index_1 == v2) && (fb_vert_index_2== v0 ||
00124          fb_vert_index_2 == v1 || fb_vert_index_2 == v2)){
00125         return true;
00126       }
00127       return false;
00128     }
00129 
00130    int v0, v1, v2;
00131    FSBoundingBox boundingbox;
00132    double a, b, c, d; // plane coefficients
00133    bool dudded;
00134    std::vector<FB_Edge*> edge_list;
00135    int parent;
00136    int cubitsurfaceindex;
00137    int cubitedge0index, cubitedge1index, cubitedge2index;
00138 };
00139 
00140 class VertexStuff {
00141 
00142 public:
00143   VertexStuff(int vert, int vert_type, double p_coord, double s_coord)
00144   {  v0 = vert;
00145      v0type = vert_type;
00146      p_dir_coord = p_coord;
00147      s_dir_coord = s_coord; 
00148   }
00149   
00150   ~VertexStuff() {
00151     edge_list.clear();
00152   }
00153   
00154   int v0;
00155   int v0type;
00156   double p_dir_coord, s_dir_coord;
00157   
00158   std::vector<FB_Edge*> edge_list;
00159 };
00160 
00161 class vertstuffcompfn_less {
00162 
00163 public:
00164   bool operator()(const VertexStuff* vfirst, const VertexStuff* vsecond) const
00165   {
00166     if ( vfirst->p_dir_coord < vsecond->p_dir_coord ) return true;
00167     else if ( vfirst->p_dir_coord > vsecond->p_dir_coord ) return false;
00168     else {
00169       if ( vfirst->s_dir_coord < vsecond->s_dir_coord ) return true;
00170       else return false;
00171     }
00172   }
00173 };
00174 
00175 class edgecompfn_less {
00176 
00177 public:
00178   bool operator()(const FB_Edge* efirst, const FB_Edge* esecond) const
00179   {
00180      if ( efirst->quadrant < esecond->quadrant ) return true;
00181      if ( efirst->quadrant > esecond->quadrant ) return false;
00182 
00183        if ( efirst->slope < esecond->slope ) return true;
00184        else return false;       
00185 
00186   }
00187 };
00188 
00189 class edgecompfn_more {
00190 
00191 public:
00192   bool operator()(const FB_Edge* efirst, const FB_Edge* esecond) const
00193   {
00194      if ( efirst->quadrant > esecond->quadrant ) return true;
00195      if ( efirst->quadrant < esecond->quadrant ) return false;
00196 //     if ( efirst->quadrant > esecond->quadrant ) return true;
00197 
00198        if ( efirst->slope < esecond->slope ) return false;
00199        else return true;       
00200 
00201   }
00202 };
00203 
00204 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines