for example, i want to find all edges and nodes located on the bd "inlet" , "outlet"........
Actually, code PointType p = viennagrid::default_point_accessor(*viennagrid::find(mesh, VertexIDType(cell_point_ID)); doesn't work. It should be PointType p = viennagrid::default_point_accessor(mesh)(*viennagrid::find(mesh, VertexIDType(cell_point_ID)));
Hello, Karli. Thanks for the answer, it seems this is what I was looking for. Best regards, Cyril
Hi Cyril, if you only have the vertex ID, but nothing else, then viennagrid::find() is all that is left. The reason is that vertex IDs do not have to be contiguous, so a direct array access is not always possible. You last code line can be simplified to PointType p = viennagrid::default_point_accessor(*viennagrid::find(mesh, VertexIDType(cell_point_ID)); Best regards, Karli
Hello, what is an elegant way to get coordinates of a mesh vertex by its id? For the time being, I've implemented it like this: typedef viennagrid::triangular_2d_mesh MeshType; typedef viennagrid::result_of::vertex<MeshType>::type VertexType; typedef viennagrid::result_of::point<MeshType>::type PointType; typedef viennagrid::result_of::id<VertexType>::type VertexIDType; unsigned int cell_point_ID = 5; PointType p = viennagrid::find(mesh, VertexIDType(cell_point_ID))[0].appendix(); which looks awkward....
Thanks for the clarification!
Hi Cyril, yes, you have to manage your own custom boundary elements. The difference between handle() and pointers is that a handle may carry more information than a pointer. In particular, a handle may hold references to parent containers, hence we deliberately chose a syntax that emphasizes the difference to a plain pointer/iterator. Best regards, Karli
Thanks, Cyril, I could reproduce the problem and pushed a fix: https://github.com/viennagrid/viennagrid-dev/commit/6e47c8d098a0b691d6b9988f2444cd11d440f4c2
Probably the section "8.2 Element Storage in Mesh and Segment" of ViennaGrid's manual answers my question. It is written that For segments, only handles to the global element objects in the mesh are stored. Since uniqueness of elements is required in segments as well, an internal storage scheme of type std::set<ElementHandleType> is chosen for non-cells, where ElementType denotes the type of the elements. I think that for storing edge ranges of particular boundaries it's supposed to use std::map<int,...
Probably the section "8.2 Element Storage in Mesh and Segment" of ViennaGrid's manual answers my question. It is written that For segments, only handles to the global element objects in the mesh are stored. Since uniqueness of elements is required in segments as well, an internal storage scheme of type std::set<ElementHandleType> is chosen for non-cells, where ElementType denotes the type of the elements. I think that for storing edge ranges of particular boundaries it's supposed to use std::map<int,...
Hello. The problem concerns boundary conditions (cell-centered finite volume method for convection equation). Let the following mesh is given: Fig. 1. Mesh To set up boundary conditions I'd like to iterate through edges which belong to boundary 0, 1, ..., 3 (see fig. 1). I am going to implement it the following way: typedef viennagrid::triangular_2d_mesh MeshType; typedef viennagrid::result_of::handle<MeshType, viennagrid::edge_tag>::type EdgeHandleType; std::map<int, std::deque<EdgeHandleType> >...
Hello. The problem concerns boundary conditions. Let the following mesh is given: Fig. 1. Mesh To set up boundary conditions I'd like to iterate through edges which belong to boundary 0, 1, ..., 3 (see fig. 1). I am going to implement it the following way: typedef viennagrid::triangular_2d_mesh MeshType; typedef viennagrid::result_of::handle<MeshType, viennagrid::edge_tag>::type EdgeHandleType; std::map<int, std::deque<EdgeHandleType> > edge_selection_ranges; std::deque<EdgeHandleType>::iterator...
Hello. The problem concerns static_array class. It seems compiler doesn't like when static_array object is used as argument of a function from STL. Consider the following example: #include <iostream> #include "viennagrid/storage/static_array.hpp" int main() { viennagrid::static_array<int, 2> A; viennagrid::static_array<int, 2> B; A[0] = 1; A[1] = 2; B[0] = 1; B[1] = 2; if (A==B) std::cout << "A==B" << std::endl; else std::cout << "A!=B" << std::endl; std::cin.get(); return EXIT_SUCCESS; } Compiler...
Hello. The problem concerns static_array class. It seems compiler doesn't like when static_array object is used as argument of a function from STL. Consider the following example: #include <iostream> #include "viennagrid/storage/static_array.hpp" int main() { viennagrid::static_array<int, 2> A; viennagrid::static_array<int, 2> B; A[0] = 1; A[1] = 2; B[0] = 1; B[1] = 2; if (A==B) std::cout << "A==B" << std::endl; else std::cout << "A!=B" << std::endl; std::cin.get(); return EXIT_SUCCESS; } It gives...
Hi Cyril, I'm glad you got it working. Please don't hesitate to ask if other questions show up. Best regards, Karli
Nevermind. The answer was found on the page http://viennagrid.sourceforge.net/viennagrid-iterators.html : // First part same as before: typedef result_of::edge_range<MeshType>::type EdgeRange; typedef result_of::iterator<EdgeRange>::type EdgeIterator; EdgeRange edges(mesh); for (EdgeIterator eit = edges.begin(); eit != edges.end(); ++eit) { // Get the types: typedef result_of::edge<MeshType>::type EdgeType; typedef result_of::vertex_range<EdgeType>::type VertexOnEdgeRange; typedef result_of::iterator<VertexOnEdgeRange>::type...
Nevermind. The answer was found on the page http://viennagrid.sourceforge.net/viennagrid-iterators.html: // First part same as before: typedef result_of::edge_range<MeshType>::type EdgeRange; typedef result_of::iterator<EdgeRange>::type EdgeIterator; EdgeRange edges(mesh); for (EdgeIterator eit = edges.begin(); eit != edges.end(); ++eit) { // Get the types: typedef result_of::edge<MeshType>::type EdgeType; typedef result_of::vertex_range<EdgeType>::type VertexOnEdgeRange; typedef result_of::iterator<VertexOnEdgeRange>::type...
Hello. First of all, thanks for the library. I'd like to iterate through all vertices of a given edge (the purpose is to get IDs of vertices). I slightly modified the example "mesh_setup.cpp" to illustrate the problem: /* ======================================================================= Copyright (c) 2011-2014, Institute for Microelectronics, Institute for Analysis and Scientific Computing, TU Wien. ----------------- ViennaGrid - The Vienna Grid Library ----------------- License: MIT (X11),...
Hello. First of all, thanks for the library. I'd like to iterate through all vertices of a given edge (the purpose is to get IDs of vertices). I slightly modify the example "mesh_setup.cpp" to illustrate the problem: /* ======================================================================= Copyright (c) 2011-2014, Institute for Microelectronics, Institute for Analysis and Scientific Computing, TU Wien. ----------------- ViennaGrid - The Vienna Grid Library ----------------- License: MIT (X11), see...