1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + This file is part of enGrid. +
5 // + Copyright 2008-2014 enGits GmbH +
7 // + enGrid is free software: you can redistribute it and/or modify +
8 // + it under the terms of the GNU General Public License as published by +
9 // + the Free Software Foundation, either version 3 of the License, or +
10 // + (at your option) any later version. +
12 // + enGrid is distributed in the hope that it will be useful, +
13 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
14 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
15 // + GNU General Public License for more details. +
17 // + You should have received a copy of the GNU General Public License +
18 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #include "vertexmeshdensity.h"
22 #include "egvtkobject.h"
26 VertexMeshDensity::VertexMeshDensity()
28 type
= EG_SIMPLE_VERTEX
;
33 //VMD=VMD of current node
34 //This operator is NOT SYMMETRICAL. But it can be used with indexOf.
35 bool VertexMeshDensity::operator==(const VertexMeshDensity
& VMD
) const
37 if(this->nodeset
.size()>0) //node ID mode
39 if(this->nodeset
.contains(VMD
.CurrentNode
) ) return(true);//node ID given, we're done
42 else //node properties mode
44 if(this->type
!=VMD
.type
&& this->type
!=-1) return(false);
46 QMapIterator
<int, int> i(this->BCmap
);
50 if((this->BCmap
)[index
]!=VMD
.BCmap
[index
] && (this->BCmap
)[index
]!=1) return(false);
57 int VertexMeshDensity::findSmallestVMD( QVector
<VertexMeshDensity
> vector
)
62 for(int i
=0;i
<vector
.size();i
++){
63 if(vector
[i
]==*this) {
66 Lmin
= vector
[i
].density
;
69 else if(vector
[i
].density
< Lmin
) {
71 Lmin
= vector
[i
].density
;
78 //converts string to nodeset
79 void VertexMeshDensity::setNodes(QString str
)
81 nodeset
.clear();//empty by default
82 // cout<<"str.size="<<str.size()<<endl;
85 QStringList L
= str
.split(",");
86 foreach(QString elt
,L
) nodeset
.insert(elt
.toInt());
90 ostream
& operator<<(ostream
&out
, VertexMeshDensity A
)
92 out
<<" BCmap="<<A
.BCmap
;
93 out
<<" type="<<(int)A
.type
;
94 out
<<" nodeset="<<A
.nodeset
;
95 out
<<" density="<<A
.density
;
99 ostream
& operator<<(ostream
&out
, QVector
<VertexMeshDensity
> VMDvector
)
101 int N
=VMDvector
.size();
107 if(i
!=N
-1) out
<<endl
;