Hello Madam or Sir,
I am the user of OpenMesh, and I want ask some questions about the parallel code with OpenMesh, exactly, the parallel code is based on OpenMP on the VS2013.
The first question: When I use the OpenMP on the VS2013 to speed up the program which write with OpenMesh, for example, I add the code: #pragma omp parallel for num_threads(7) , just like the following:
and the errors follow, and I do not know why.
and the second question: Could the code with iterator of OpenMesh be paralleled by OpenMP just like " for (TriMesh::FaceIter f_it = mesh.faces_begin(); f_it != mesh.faces_end(); f_it++) " in the above picture? or How can I parallel the code with iterator of OpenMesh?
Thank you for your time! And I am looking forward to your reply.
Sincerely
LuWang
Hi to all.
Before asking my question I would like to state two important things:
1) My goal is to work with 2d triangular/polygonal meshes, from which i don't see any examples in the documentation. As a starting point I want to create and export (to a .vtk file) a simple 2d polygonal mesh, i.e. just a square.
2) I'm new to the library so this might be a rather broad/general question.
Now, here's what i have tried.
1) I've started with the tutorial "Building a cube". There i have managed to export the mesh to a .vtk file doing the following (variable names follow from the tutorial):
//
typedef OpenMesh::IO::ExporterT<MyMesh> BaseExporter;
BaseExporter be = BaseExporter(mesh);
OpenMesh::IO::Options opt = OpenMesh::IO::Options::Default;
OpenMesh::IO::_VTKWriter_ mywriter;
mywriter.write("output.vtk",be,opt,sizeof(double));
//
2) Now i want to modify this tutorial example to have a single square. To be clear, I want a 2d geometry, not a 3d geometry whose vertices have constant z=0 coordinate. This is how i define the mesh:
//
MyMesh::VertexHandle vhandle[4];
vhandle[0] = mesh.add_vertex(MyMesh::Point(-1, -1));
vhandle[1] = mesh.add_vertex(MyMesh::Point( 1, -1));
vhandle[2] = mesh.add_vertex(MyMesh::Point( 1, 1));
vhandle[3] = mesh.add_vertex(MyMesh::Point(-1, 1));
std::vector<MyMesh::VertexHandle> face_vhandles;
face_vhandles.clear();
face_vhandles.push_back(vhandle[0]);
face_vhandles.push_back(vhandle[1]);
face_vhandles.push_back(vhandle[2]);
face_vhandles.push_back(vhandle[3]);
mesh.add_face(face_vhandles)
//
When i try to compile the code last code i get the following error, amongst many others:
no matching function for call to ‘OpenMesh::VectorT<float, 3>::VectorT(int, int)’ vhandle[0] = mesh.add_vertex(MyMesh::Point(-1, -1));
Now, these are my questions:
1) How can i create a 2d polygonal mesh? I guess i have to give the proper template parameter to type definition on
typedef OpenMesh::PolyMesh_ArrayKernelT<> MyMesh;
but i don't know what to put in there exactly.
2) How is that going to affect the BaseExporter that i use to create the .vtk file? I am asking this because i already manage to create a 2d mesh following what i found in one of the unit tests, namely unittests_polymesh_vec2i.cc, but then i cannot export the mesh following the approach i had used for the cube. So, just in case anyone would suggest that piece of code as an answer to my question.
Any thoughts or suggestions will be greatly appreciated :)
Kind regards,
Hi,
OpenMesh has implemented the functionalities to s/r custom property of
vector<T> in
OpenMesh/Core/IO/SR_binary_vector_of_fundamentals.inl.
However it seems to expect the size to be known in advance when restoring.
Is there a way to restore the size dynamically?
I think maybe it's better to store the size as well?
Kind regards
Hi there,
I stumbled across a pretty infuriating bug in OpenMesh 8.0 (I think it still might exist in 8.1) in the `restore` function for `PropertyT<bool>` (`Property.hh`) (though this issue may exist elsewhere quite possibly...).
The issue occurs at the beginning of the for loop where the bit packing happens (around line 313). The problematic statement is `_istr >> bits;`
The problem is `std::istream` by default skips white space characters (https://en.cppreference.com/w/cpp/io/manip/skipws), so if one of the bytes in the stream being restored happens to be 0x20 (32 - 'space' character), it will be skipped, leading to the stream getting out of sync with the bytes read (I was able to track this down using lots of `_is.tellg();` calls).
I've made a minimal change in Property.hh to ensure white space characters aren't skipped: `_istr >> std::noskipws;` right before the for loop. There might be a better more central place to enable this setting but it resolves the bug for us for now. If anyone has any feedback on the best place for this fix I'd love to know!
Thanks!
Tom