mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
Vec3d to Vec<3>, comparison operator for Vec<>
This commit is contained in:
parent
385040333b
commit
05e6456ec2
@ -120,6 +120,11 @@ namespace netgen
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator== (const Vec<D,T> &a)
|
||||||
|
{
|
||||||
|
return x[0]==a.x[0] && x[1]==a.x[1] && x[2]==a.x[2];
|
||||||
|
}
|
||||||
|
|
||||||
T & operator() (int i) { return x[i]; }
|
T & operator() (int i) { return x[i]; }
|
||||||
const T & operator() (int i) const { return x[i]; }
|
const T & operator() (int i) const { return x[i]; }
|
||||||
|
|
||||||
|
@ -818,11 +818,11 @@ namespace netgen
|
|||||||
outfile.width(8);
|
outfile.width(8);
|
||||||
outfile << GetFaceDescriptor(i).SurfNr()+1 << " ";
|
outfile << GetFaceDescriptor(i).SurfNr()+1 << " ";
|
||||||
outfile.width(12);
|
outfile.width(12);
|
||||||
outfile << GetFaceDescriptor(i).SurfColour().X() << " ";
|
outfile << GetFaceDescriptor(i).SurfColour()[0] << " ";
|
||||||
outfile.width(12);
|
outfile.width(12);
|
||||||
outfile << GetFaceDescriptor(i).SurfColour().Y() << " ";
|
outfile << GetFaceDescriptor(i).SurfColour()[1] << " ";
|
||||||
outfile.width(12);
|
outfile.width(12);
|
||||||
outfile << GetFaceDescriptor(i).SurfColour().Z();
|
outfile << GetFaceDescriptor(i).SurfColour()[2];
|
||||||
outfile << endl;
|
outfile << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1163,7 +1163,7 @@ namespace netgen
|
|||||||
|
|
||||||
// Philippose - 06/07/2009
|
// Philippose - 06/07/2009
|
||||||
// Get Surface colour
|
// Get Surface colour
|
||||||
Vec3d SurfColour () const { return surfcolour; }
|
Vec<3> SurfColour () const { return surfcolour; }
|
||||||
DLL_HEADER const string & GetBCName () const { return *bcname; }
|
DLL_HEADER const string & GetBCName () const { return *bcname; }
|
||||||
// string * BCNamePtr () { return bcname; }
|
// string * BCNamePtr () { return bcname; }
|
||||||
// const string * BCNamePtr () const { return bcname; }
|
// const string * BCNamePtr () const { return bcname; }
|
||||||
@ -1174,7 +1174,7 @@ namespace netgen
|
|||||||
void SetBCName (string * bcn); // { bcname = bcn; }
|
void SetBCName (string * bcn); // { bcname = bcn; }
|
||||||
// Philippose - 06/07/2009
|
// Philippose - 06/07/2009
|
||||||
// Set the surface colour
|
// Set the surface colour
|
||||||
void SetSurfColour (Vec3d colour) { surfcolour = colour; }
|
void SetSurfColour (Vec<3> colour) { surfcolour = colour; }
|
||||||
|
|
||||||
void SetDomainInSingular (double v) { domin_singular = v; }
|
void SetDomainInSingular (double v) { domin_singular = v; }
|
||||||
void SetDomainOutSingular (double v) { domout_singular = v; }
|
void SetDomainOutSingular (double v) { domout_singular = v; }
|
||||||
|
@ -138,6 +138,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
|||||||
py::class_<Vec<2>> (m, "Vec2d")
|
py::class_<Vec<2>> (m, "Vec2d")
|
||||||
.def(py::init<double,double>())
|
.def(py::init<double,double>())
|
||||||
.def ("__str__", &ToString<Vec<3>>)
|
.def ("__str__", &ToString<Vec<3>>)
|
||||||
|
.def(py::self==py::self)
|
||||||
.def(py::self+py::self)
|
.def(py::self+py::self)
|
||||||
.def(py::self-py::self)
|
.def(py::self-py::self)
|
||||||
.def(-py::self)
|
.def(-py::self)
|
||||||
@ -150,6 +151,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
|||||||
py::class_<Vec<3>> (m, "Vec3d")
|
py::class_<Vec<3>> (m, "Vec3d")
|
||||||
.def(py::init<double,double,double>())
|
.def(py::init<double,double,double>())
|
||||||
.def ("__str__", &ToString<Vec<3>>)
|
.def ("__str__", &ToString<Vec<3>>)
|
||||||
|
.def(py::self==py::self)
|
||||||
.def(py::self+py::self)
|
.def(py::self+py::self)
|
||||||
.def(py::self-py::self)
|
.def(py::self-py::self)
|
||||||
.def(-py::self)
|
.def(-py::self)
|
||||||
@ -492,20 +494,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
|||||||
[](FaceDescriptor & self) -> string { return self.GetBCName(); },
|
[](FaceDescriptor & self) -> string { return self.GetBCName(); },
|
||||||
[](FaceDescriptor & self, string name) { self.SetBCName(new string(name)); } // memleak
|
[](FaceDescriptor & self, string name) { self.SetBCName(new string(name)); } // memleak
|
||||||
)
|
)
|
||||||
.def_property("color",
|
.def_property("color", &FaceDescriptor::SurfColour, &FaceDescriptor::SetSurfColour )
|
||||||
[](FaceDescriptor & self)
|
|
||||||
{
|
|
||||||
auto c = self.SurfColour();
|
|
||||||
return py::make_tuple( c.X(), c.Y(), c.Z() );
|
|
||||||
},
|
|
||||||
[](FaceDescriptor & self, py::tuple color)
|
|
||||||
{
|
|
||||||
Vec3d c;
|
|
||||||
c.X() = py::extract<double>(color[0])();
|
|
||||||
c.Y() = py::extract<double>(color[1])();
|
|
||||||
c.Z() = py::extract<double>(color[2])();
|
|
||||||
self.SetSurfColour(c);
|
|
||||||
})
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
@ -416,11 +416,11 @@ namespace netgen
|
|||||||
if(!(geom.face_colours.IsNull())
|
if(!(geom.face_colours.IsNull())
|
||||||
&& (geom.face_colours->GetColor(face,XCAFDoc_ColorSurf,face_colour)))
|
&& (geom.face_colours->GetColor(face,XCAFDoc_ColorSurf,face_colour)))
|
||||||
{
|
{
|
||||||
mesh.GetFaceDescriptor(facenr).SetSurfColour(Vec3d(face_colour.Red(),face_colour.Green(),face_colour.Blue()));
|
mesh.GetFaceDescriptor(facenr).SetSurfColour({face_colour.Red(),face_colour.Green(),face_colour.Blue()});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mesh.GetFaceDescriptor(facenr).SetSurfColour(Vec3d(0.0,1.0,0.0));
|
mesh.GetFaceDescriptor(facenr).SetSurfColour({0.0,1.0,0.0});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(geom.fnames.Size()>=facenr)
|
if(geom.fnames.Size()>=facenr)
|
||||||
|
@ -1019,9 +1019,8 @@ namespace netgen
|
|||||||
// the mesh data structure, rather than limit it to the OCC geometry
|
// the mesh data structure, rather than limit it to the OCC geometry
|
||||||
// structure... allows other geometry types to use face colours too
|
// structure... allows other geometry types to use face colours too
|
||||||
|
|
||||||
matcol[0] = mesh->GetFaceDescriptor(faceindex).SurfColour().X();
|
for (auto i : Range(3))
|
||||||
matcol[1] = mesh->GetFaceDescriptor(faceindex).SurfColour().Y();
|
matcol[i] = mesh->GetFaceDescriptor(faceindex).SurfColour()[i];
|
||||||
matcol[2] = mesh->GetFaceDescriptor(faceindex).SurfColour().Z();
|
|
||||||
matcol[3] = 1.0;
|
matcol[3] = 1.0;
|
||||||
|
|
||||||
if (faceindex == selface)
|
if (faceindex == selface)
|
||||||
|
Loading…
Reference in New Issue
Block a user