2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008-2012 enGits GmbH +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 #include "vertexmeshdensity.h"
24 #include "egvtkobject.h"
28 VertexMeshDensity::VertexMeshDensity()
30 type
= EG_SIMPLE_VERTEX
;
35 //VMD=VMD of current node
36 //This operator is NOT SYMMETRICAL. But it can be used with indexOf.
37 bool VertexMeshDensity::operator==(const VertexMeshDensity
& VMD
) const
39 if(this->nodeset
.size()>0) //node ID mode
41 if(this->nodeset
.contains(VMD
.CurrentNode
) ) return(true);//node ID given, we're done
44 else //node properties mode
46 if(this->type
!=VMD
.type
&& this->type
!=-1) return(false);
48 QMapIterator
<int, int> i(this->BCmap
);
52 if((this->BCmap
)[index
]!=VMD
.BCmap
[index
] && (this->BCmap
)[index
]!=1) return(false);
59 int VertexMeshDensity::findSmallestVMD( QVector
<VertexMeshDensity
> vector
)
64 for(int i
=0;i
<vector
.size();i
++){
65 if(vector
[i
]==*this) {
68 Lmin
= vector
[i
].density
;
71 else if(vector
[i
].density
< Lmin
) {
73 Lmin
= vector
[i
].density
;
80 //converts string to nodeset
81 void VertexMeshDensity::setNodes(QString str
)
83 nodeset
.clear();//empty by default
84 // cout<<"str.size="<<str.size()<<endl;
87 QStringList L
= str
.split(",");
88 foreach(QString elt
,L
) nodeset
.insert(elt
.toInt());
92 ostream
& operator<<(ostream
&out
, VertexMeshDensity A
)
94 out
<<" BCmap="<<A
.BCmap
;
95 out
<<" type="<<(int)A
.type
;
96 out
<<" nodeset="<<A
.nodeset
;
97 out
<<" density="<<A
.density
;
101 ostream
& operator<<(ostream
&out
, QVector
<VertexMeshDensity
> VMDvector
)
103 int N
=VMDvector
.size();
109 if(i
!=N
-1) out
<<endl
;