diff --git a/libsrc/csg/edgeflw.cpp b/libsrc/csg/edgeflw.cpp index 9ba3af9f..6afa4957 100644 --- a/libsrc/csg/edgeflw.cpp +++ b/libsrc/csg/edgeflw.cpp @@ -1410,7 +1410,6 @@ namespace netgen seg.surfnr2 = refedges.Get(k).surfnr2; seg.seginfo = 0; if (k == 1) seg.seginfo = (refedgesinv.Get(k)) ? 2 : 1; - *testout << "add segment at 3" << endl; mesh.AddSegment (seg); //(*testout) << "add seg " << mesh[seg.p1] << "-" << mesh[seg.p2] << endl; //(*testout) << "refedge " << k << " surf1 " << seg.surfnr1 << " surf2 " << seg.surfnr2 << " inv " << refedgesinv.Get(k) << endl; @@ -1579,7 +1578,6 @@ namespace netgen seg.surfnr2 = refedges.Get(k).surfnr2; seg.seginfo = 0; if (k == 1) seg.seginfo = (refedgesinv.Get(k)) ? 2 : 1; - *testout << "add segment at 1" << endl; mesh.AddSegment (seg); // (*testout) << "add seg " << seg[0] << "-" << seg[1] << endl; } @@ -1711,7 +1709,6 @@ namespace netgen seg.surfnr2 = refedges.Get(k).surfnr2; seg.seginfo = 0; if (k == 1) seg.seginfo = refedgesinv.Get(k) ? 2 : 1; - *testout << "add segment at 2" << endl; mesh.AddSegment (seg); // (*testout) << "copy seg " << seg[0] << "-" << seg[1] << endl; #ifdef DEVELOP diff --git a/libsrc/meshing/meshclass.cpp b/libsrc/meshing/meshclass.cpp index b890399b..2423c03e 100644 --- a/libsrc/meshing/meshclass.cpp +++ b/libsrc/meshing/meshclass.cpp @@ -1120,7 +1120,7 @@ namespace netgen { Segment & seg = LineSegment(i); if ( seg.cd2i <= n ) - seg.SetBCName (cd2names[seg.cd2i-1]); + seg.SetBCName (cd2names[seg.edgenr-1]); else seg.SetBCName(0); } @@ -1407,7 +1407,9 @@ namespace netgen if(seg.surfnr2 >= 0) seg.surfnr2 = seg.surfnr2 + max_surfnr; seg[0] = seg[0] +oldnp; seg[1] = seg[1] +oldnp; + *testout << "old edgenr: " << seg.edgenr << endl; seg.edgenr = seg.edgenr + oldne; + *testout << "new edgenr: " << seg.edgenr << endl; seg.epgeominfo[1].edgenr = seg.epgeominfo[1].edgenr + oldne; AddSegment (seg); diff --git a/libsrc/meshing/meshclass.hpp b/libsrc/meshing/meshclass.hpp index a41b2b33..d09b7c98 100644 --- a/libsrc/meshing/meshclass.hpp +++ b/libsrc/meshing/meshclass.hpp @@ -595,6 +595,7 @@ namespace netgen DLL_HEADER void SetCD2Name (int cd2nr, const string & abcname); const string & GetCD2Name (int cd2nr ) const; + size_t GetNCD2Names() const { return cd2names.Size(); } string * GetBCNamePtr (int bcnr) const { return bcnr < bcnames.Size() ? bcnames[bcnr] : nullptr; } diff --git a/libsrc/meshing/meshtype.hpp b/libsrc/meshing/meshtype.hpp index 78598a44..80be7fa1 100644 --- a/libsrc/meshing/meshtype.hpp +++ b/libsrc/meshing/meshtype.hpp @@ -251,6 +251,8 @@ namespace netgen singular = 0; } + void Scale(double factor) { *testout << "before: " << x[0] << endl; x[0] *= factor; x[1] *= factor; x[2] *= factor; *testout << "after: " << x[0] << endl;} + int GetLayer() const { return layer; } POINTTYPE Type() const { return type; } diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index eb14c78d..fd6a8c37 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -216,6 +216,7 @@ DLL_HEADER void ExportNetgenMeshing() tmp->surfnr1 = bp::extract(surfaces[0]); tmp->surfnr2 = bp::extract(surfaces[1]); } + tmp->edgenr = index; return tmp; }), bp::default_call_policies(), @@ -242,6 +243,10 @@ DLL_HEADER void ExportNetgenMeshing() li.append (self.surfnr2); return li; })) + .add_property("index", FunctionPointer([](const Segment &self) -> size_t + { + return self.edgenr; + })) ; @@ -465,6 +470,11 @@ DLL_HEADER void ExportNetgenMeshing() .def ("SetMaterial", &Mesh::SetMaterial) .def ("GetMaterial", FunctionPointer([](Mesh & self, int domnr) { return string(self.GetMaterial(domnr)); })) + + .def ("SetCD2Name", &Mesh::SetCD2Name) + .def ("GetCD2Name", FunctionPointer([](Mesh & self, int nr) -> string + { return self.GetCD2Name(nr); })) + .def ("GetNCD2Names", &Mesh::GetNCD2Names) .def ("GenerateVolumeMesh", FunctionPointer ([](Mesh & self) @@ -564,6 +574,12 @@ DLL_HEADER void ExportNetgenMeshing() GenerateBoundaryLayer (self, blp); } )) + + .def ("Scale", FunctionPointer([](Mesh & self, double factor) + { + for(auto i = 0; i