node.cpp 2.17 KB
Newer Older
Kirill Terekhov's avatar
Kirill Terekhov committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
#include "inmost.h"
#if defined(USE_MESH)
namespace INMOST
{

	Node::Node(Mesh * m) :Element(m,NODE)
	{
	}
	
	Node::Node(Mesh * m, INMOST_DATA_ENUM_TYPE lid, const Node & other) :Element(m,lid,other){}

	Node::Node(const Node & other) :Element(other){}

	
	Node & Node::operator =(Node const & other)
	{
		Element::operator =(other);
		return *this;
	}
	
	Node::~Node()
	{
		
	}
	
	adjacent<Edge> Node::getEdges()
	{
		if( !GetMeshLink()->HideMarker() )
			return adjacent<Edge>(high_conn.begin(),high_conn.end());
		else
		{
			MIDType hm = GetMeshLink()->HideMarker();
			adjacent<Edge> aret;
			for(adj_iterator it = high_conn.begin(); it != high_conn.end(); ++it)
				if( !(*it)->GetMarker(hm) ) aret.push_back((*it));
			return aret;
		}
	}
	
	adjacent<Face> Node::getFaces()
	{
		adjacent<Face> aret;
		Mesh * m = GetMeshLink();
		MIDType mrk = m->CreateMarker();
		if( !GetMeshLink()->HideMarker() )
		{
			for(Element::adj_iterator it = high_conn.begin(); it != high_conn.end(); it++) //edges
				for(Element::adj_iterator jt = (*it)->high_conn.begin(); jt != (*it)->high_conn.end(); jt++) //faces
					if( !(*jt)->GetMarker(mrk))
					{
						aret.push_back(*jt);
						(*jt)->SetMarker(mrk);
					}
		}
		else
		{
			MIDType hm = GetMeshLink()->HideMarker();
			for(Element::adj_iterator it = high_conn.begin(); it != high_conn.end(); it++) if( !(*it)->GetMarker(hm) )//edges
				for(Element::adj_iterator jt = (*it)->high_conn.begin(); jt != (*it)->high_conn.end(); jt++) if( !(*jt)->GetMarker(hm) ) //faces
					if( !(*jt)->GetMarker(mrk))
					{
						aret.push_back(*jt);
						(*jt)->SetMarker(mrk);
					}
		}
		for(adjacent<Face>::iterator it = aret.begin(); it != aret.end(); it++)
			it->RemMarker(mrk);
		m->ReleaseMarker(mrk);
		return aret;
	}
	
	adjacent<Cell> Node::getCells()
	{
		if( !GetMeshLink()->HideMarker() )
			return adjacent<Cell>(low_conn.begin(),low_conn.end());
		else
		{
			MIDType hm = GetMeshLink()->HideMarker();
			adjacent<Cell> aret;
			for(adj_iterator it = low_conn.begin(); it != low_conn.end(); ++it)
				if( !(*it)->GetMarker(hm) ) aret.push_back((*it));
			return aret;
		}
	}

	Storage::real_array Node::Coords() {return RealArrayDF(GetMeshLink()->CoordsTag());}
}

#endif