DeleteSetOfPoints function working
[engrid.git] / vertexmeshdensity.cpp
blob1a57e3b0678867480dd171326e74562f71206fea
1 #include "vertexmeshdensity.h"
2 #include "egvtkobject.h"
3 #include <iostream>
4 using namespace std;
6 VertexMeshDensity::VertexMeshDensity()
11 // VertexMeshDensity::~VertexMeshDensity()
12 // {
13 // }
15 //this=user defined
16 //VMD=VMD of current node
17 //This operator is NOT SYMMETRICAL. But it can be used with indexOf.
18 bool VertexMeshDensity::operator==(const VertexMeshDensity & VMD) const
20 /* cout<<"this->nodeset="<<this->nodeset<<endl;
21 cout<<"VMD.nodeset="<<VMD.nodeset<<endl;*/
23 if(this->nodeset.size()>0) //node ID mode
25 if(this->nodeset.contains(VMD.CurrentNode) ) return(true);//node ID given, we're done
26 else return(false);
28 else //node properties mode
30 if(this->type!=VMD.type && this->type!=-1) return(false);
32 QMapIterator<int, int> i(this->BCmap);
33 while (i.hasNext()) {
34 i.next();
35 // cout << i.key() << ": " << i.value() << endl;
36 int index=i.key();
37 if((this->BCmap)[index]!=VMD.BCmap[index] && (this->BCmap)[index]!=1) return(false);
40 return(true);
44 //converts string to nodeset
45 void VertexMeshDensity::SetNodes(QString str)
47 nodeset.clear();//empty by default
48 cout<<"str.size="<<str.size()<<endl;
49 if(str.size()>0)
51 QStringList L = str.split(",");
52 foreach(QString elt,L) nodeset.insert(elt.toInt());
56 // QVector < QVector <int> > BClist;
57 // QVector <char> type;
58 // QVector <double> density;
60 ostream& operator<<(ostream &out, VertexMeshDensity A)
62 out<<" BClist="<<A.BClist;
63 out<<" BCmap="<<A.BCmap;
64 out<<" type="<<(int)A.type;
65 out<<" nodeset="<<A.nodeset;
66 out<<" density="<<A.density;
67 return(out);
70 ostream& operator<<(ostream &out, QVector<VertexMeshDensity> VMDvector)
72 int N=VMDvector.size();
73 out<<"Size="<<N;
74 if(N>0) out<<endl;
75 for(int i=0;i<N;i++)
77 out<<VMDvector[i];
78 if(i!=N-1) out<<endl;
80 return(out);