A larger cube minus a smaller cube tetrahedral mesh without hanging nodes.

54 views
Skip to first unread message

Jan Valdman

unread,
Jun 24, 2016, 10:34:25 AM6/24/16
to iso2mesh-users


Hi everybody, 

Can I create a tetrahedral mesh of a larger cube minus a smaller cube similar to one in the picture below? The result is however not good for me since it contain hanging nodes. 

I got this result by 

[node2,face2,elem2]=meshabox([-1,-1 0],[1 0 1],0.1,1);
[node3,face3,elem3]=meshabox([-1,0, 0],[0 1 1],0.1,1);
[node4,face4,elem4]=meshabox([-1,-1, -1],[1 1 0],0.1,1);
[newnode,newelem]=mergemesh(node2,elem2,node3,elem3,node4,elem4);
plotmesh(newnode,newelem);

Can you help further? 

Best wishes,
Jan Valdman


Qianqian Fang

unread,
Jun 24, 2016, 1:12:29 PM6/24/16
to iso2mes...@googlegroups.com
On 06/24/2016 09:16 AM, Jan Valdman wrote:


Hi everybody, 

Can I create a tetrahedral mesh of a larger cube minus a smaller cube similar to one in the picture below? The result is however not good for me since it contain hanging nodes. 

I got this result by 

[node2,face2,elem2]=meshabox([-1,-1 0],[1 0 1],0.1,1);
[node3,face3,elem3]=meshabox([-1,0, 0],[0 1 1],0.1,1);
[node4,face4,elem4]=meshabox([-1,-1, -1],[1 1 0],0.1,1);
[newnode,newelem]=mergemesh(node2,elem2,node3,elem3,node4,elem4);

hi Jan

this is not going to work because each cubic mesh was generated
without knowing the boundary nodes of other cubes, therefore, they
can have mismatched surfaces along the internal boundaries.

currently, the utility to generate this kind of mesh in iso2mesh
is limited, but is not impossible. Here is a workaround:

[no,fc,c0]=latticegrid(-1:1,-1:1,-1:1); % create a 3d lattice grid
newfc=cell2mat(fc)                      % all the faces of the lattice
[ix,jx]=find(newfc==size(no,1));        % find the 3 faces connected to the corner point
newfc(ix,:)=[];                         % remove them
newfc=num2cell(newfc,2)                 % convert the face node list back to cell
[node,elem]=s2m(no,newfc,1,0.001);    % mesh the lattice with a broken corner
% [node,elem]=s2m(no,newfc,1,0.001,'tetgen',c0);    % call this if you want to distinguish the cubes
plotmesh(node,elem)                     % plot the mesh

another workaround is to use the binary image-based meshing capability of iso2mesh:

mask=zeros(4,4,4);  % create a 3d 0-1 binary mask of your shape
mask(2:3,2:3,2:3)=1;
mask(3,3,3)=0;      % remove the corner voxel
[no,fc]=binsurface(mask); % create the triangular boundary of the shape
no=no-2;
[node,elem]=s2m(no,fc,1,0.001); % create the tet mesh of the shape
plotmesh(node,elem)

generated mesh plots are attached.

let me know if these ticks help.

Qianqian

plotmesh(newnode,newelem);

Can you help further? 

Best wishes,
Jan Valdman


--
You received this message because you are subscribed to the Google Groups "iso2mesh-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iso2mesh-user...@googlegroups.com.
To post to this group, send email to iso2mes...@googlegroups.com.
Visit this group at https://groups.google.com/group/iso2mesh-users.
For more options, visit https://groups.google.com/d/optout.

The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.


cube_remove_corner.png
cube_remove_corner_colors.png

Jan Valdman

unread,
Jun 24, 2016, 4:00:43 PM6/24/16
to iso2mesh-users
Dear Qianqian,

        this is perfect, I will try it out and let you know. 

        Thank you so much!
        Best, Jan
Reply all
Reply to author
Forward
0 new messages