hi Giovanna,
please use the below sample code provided in the basic mmclab example
https://github.com/fangq/mmc/blob/v2024.2/mmclab/example/demo_mmclab_basic.m#L37-L43
the tick is to set 'cdata' of the triangles in a patch object.
Qianqian
--
You received this message because you are subscribed to the Google Groups "mmc-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mmc-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mmc-users/27d3d4ce-e53b-4f8a-a365-5a8de46dc492n%40googlegroups.com.
you can use the meshcentroid() function in iso2mesh to compute the centroid of each surface triangle, and associate the dref value to that centroid (but you will have to tessellate these centroid to form a new mesh).
alternatively, you can split the dref value on each triangle and attribute 1/3*area*elem_value to each vertex of the triangle, sum them for each surface node, and then divide the nodevolume() of each node, which is the sum of the 1/3*area of all surrounding triangles attached to a node. pseudo code can be found below:
% surftri is the surface triangle node list
nodal_dref=zeros(1:length(cfg.node))
tri_area=elemvolume(cfg.node, surftri)
nodal_area=nodevolume(cfg.node, surftri,
tri_area
)
for i=1:length(surftri)
for j=1:3
nodal_dref(surftri(i,j)) = nodal_dref(surftri(i,j)) + tri_area(i)*dref(i)
end
end
nodal_dref=nodal_dref*(1/3);
nodal_dref(
nodal_area > 0
)=
nodal_dref
(nodal_area > 0)
./
nodal_area
(nodal_area > 0)
you can do this more efficiently if you use vector operations
(i.e. use accumarray() function)
Qianqian
To view this discussion on the web visit https://groups.google.com/d/msgid/mmc-users/0fec4778-cc45-4fa1-94a3-018b3543d1aan%40googlegroups.com.