I'am looking for help with following problem.
In my code I have defindes vertices, edges and polygons as class handle objects and each of them are linked to each other.
So the vertices knows its position and knows to which are its neighbour vertices and to which edges it belongs and which are its adjacend polygons. Same for the polygons which knows what its limiting vertices and edges are and ame for edges how know to whcih polygos its adjacend and of which vertices it consist of.
Now i need to refine my mesh by adding more vertices on the edges. So i add a new vertex on one edge and I have to relinked to previous neighbour vertices to the new vertex and cut the link to each other, i have to create new linkages to the polygons and same for polygon i need new linkages to its new limiting vertex and new edge.
Since thats pretty time consuming , especially whne i need to do it multiple times in a row, I wanted to do in parrallel since I expect a huge benefit from that.
It tried it with a parfor but it didnt work and i got the error not enough input arguments and I guess the error is that while for example look at the vertices a,b,c and the edges AB and BC, that while I am adding a vertex to AB, like AD, DB , I am changing the properties of B, more precisely the linkes of B to its edges and vertices and that the problem that I run into problems when another worker wants to calculate the edge BC at the same time.
Does anybody has an idea how to do a workaround? I thought about somehow saving the new links that can be applied later but i have no idea of how to do that.
In the code below you can see the loop that is splittig the edges and the split fuction which is a hndle class of the edges itsself.
new_vertex = Vertex.empty(length(edge),0);
for i =1:length(edge)
classdef Edge < handle
ed.adjacend_vertex = Vertex.empty(0,0);
ed.adjacend_polygon = Polygon.empty(0,0);
new_vert_pos=(P1(:) + P2(:)).'/2;
v = Vertex(new_vert_pos);
if id(1)==1 && id(1)+1~=id(2)
Maybe somebody can help my with this.
Many Thanks in advance