Path: blob/devel/meshgen2d/src/include/GeometryEdge.h
3203 views
#if !defined( BL_GEOMETRYEDGE_H )1#define BL_GEOMETRYEDGE_H23#include <fstream>4#include <vector>5#include <map>67#include "GeometryNode.h"8#include "MeshNode.h"9#include "BoundaryElement.h"1011enum edge_type { VIRTUAL = 0, OUTER, INNER };1213class BGMesh;1415typedef std::map< int, Node * > NodeMap;16typedef std::map< int, Node * >::iterator NodeMapIt;1718class GeometryEdge19{20public:21friend std::ostream& operator<< (std::ostream& o, const GeometryEdge& A);2223GeometryEdge( int nSegments = 0 );24GeometryEdge( const int t, int nSegments = 0 );25~GeometryEdge() { }2627void addNode(GeometryNode* a) { dots.push_back(a); }2829void addBGMesh(BGMesh *m) { bgMeshes.push_back(m); }3031virtual int size() { return nodes.size(); }3233virtual void discretize( NodeMap& allNodes );3435void exportNodes(std::vector<Node*>& strip, int direction);3637virtual void exportGeometryNodes(38std::vector<GeometryNode*>& strip, const int direction)39{40if( direction > 0 )41std::copy( dots.begin(), dots.end(), std::back_inserter( strip ) );42else43std::copy( dots.rbegin(), dots.rend(), std::back_inserter( strip ) );44}4546void elements(std::vector< BoundaryElement * >& strip, int direction);4748GeometryNode* base() { return dots.front(); }49GeometryNode* end() { return dots.back(); }5051void setBoundaryTag( const int t ) { boundaryTag = t; }52void makeOuter() { type = OUTER; }53void makeInner() { type = INNER; }54void makeVirtual() { type = VIRTUAL; }5556bool isVirtual() { return type == VIRTUAL; }57bool isOuter() { return type == OUTER; }5859bool isConstant() { return segments > 0; }60void setSegments(int s) { segments = s; }6162void midNodes( Node*& a, Node*& b, int dir );6364int tag;6566void getGridPoints(double ox, double oy, double cellsize, std::vector<int> &x, std::vector<int> &y, std::vector<double> &delta);67protected:68void discretizeConstantSegment( int nSeg, NodeMap& allNodes, GeometryNode *from, GeometryNode *to );69void discretizeGradedSegment( NodeMap& allNodes, GeometryNode *from, GeometryNode *to );7071double interpolate(double x, double y);7273std::vector< GeometryNode* > dots;74std::vector<Node*> nodes;7576int segments;77int boundaryTag;78edge_type type;7980std::vector< BoundaryElement * > bels;8182std::vector< BGMesh * > bgMeshes;83};8485std::ostream& operator<< (std::ostream& o, const GeometryEdge& A);8687#endif /* BL_GEOMETRYEDGE_H */888990