Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.
Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
function geominfo crashes MATLAB
Posted 2009年12月8日 GMT-5 12:09 Version 3.5a 3 Replies
Please login with a confirmed email address before reporting spam
Hi,
I'm trying to write a function that will allow me to determine what faces are in a 3D region. To do this, I am attempting to use geominfo to collect the coordinate information of the faces of a geometry. I am starting by using the example given in the documentation for the geominfo function as given below.
-----------------------
% Create a solid block object with a circular curve object on top
g3 = geomcsg({block3},{},...
{move(embed(circ1(0.5,0.5,0.3)),[0 0 1])})
geomplot(g3,'facelabels','on')
% The generated object g3 is a solid 3D object consisting of 1
% subdomain, 7 faces, 16 edges and 12 vertices.
[gd,no,rng,ud,nbs] = geominfo(g3,...
'out',{'gd' 'no' 'rng' 'ud' 'nbs'},'od',0:3);
% The following commands, set up parameter matrices in two
% different formats, for faces 4, 5, and 7.
[u,v] = meshgrid(0:0.2:1,0:0.2:1);
S1 = reshape([u(:) v(:)],1,36,2);
B1 = 7;
S2(1,:,:) = deal([u(:) v(:)]);
S2(2,:,:) = deal([u(:) v(:)]);
B2 = [4;5];
% Parameter values for the bounding edges of face 7, can be
% obtained by the following commands.
adj = geominfo(g3,'out','adj','odp',[1;2])
S3 = repmat(linspace(rng{2}(1,13),rng{2}(2,13),10),[4 1 1]);
B3 = find(adj{1}(:,7));
% Now, coordinate values of the faces and edges given above,
% together with coordinates for vertex 3, are obtained as follows.
[xx] = geominfo(g3,'out',{'xx'},...
'par',{{B1 S1} {B2 S2} {B3 S3} {3}})
% To see the obtained results, simply give the following commands.
hold on
plot3(xx{1}(:,:,1),xx{1}(:,:,2),xx{1}(:,:,3),'r.')
plot3(xx{3}(:,:,1),xx{3}(:,:,2),xx{3}(:,:,3),'b.')
% Finally, derivatives and curvatures, for both faces and edges are
% with the command below.
[dx,crv] = geominfo(g3,'out',{'dx' 'crv'},...
'par',{{B1 S1} {B3 S3}})
-----------------------
When the code reaches this portion:
[xx] = geominfo(g3,'out',{'xx'},...
'par',{{B1 S1} {B2 S2} {B3 S3} {3}})
MATLAB crashes. Any insight as to how I can fix this issue would be greatly appreciated. I am running COMSOL 3.5a and MATLAB r2009b on mac OS X 10.5.8.
Thanks,
Matt
I'm trying to write a function that will allow me to determine what faces are in a 3D region. To do this, I am attempting to use geominfo to collect the coordinate information of the faces of a geometry. I am starting by using the example given in the documentation for the geominfo function as given below.
-----------------------
% Create a solid block object with a circular curve object on top
g3 = geomcsg({block3},{},...
{move(embed(circ1(0.5,0.5,0.3)),[0 0 1])})
geomplot(g3,'facelabels','on')
% The generated object g3 is a solid 3D object consisting of 1
% subdomain, 7 faces, 16 edges and 12 vertices.
[gd,no,rng,ud,nbs] = geominfo(g3,...
'out',{'gd' 'no' 'rng' 'ud' 'nbs'},'od',0:3);
% The following commands, set up parameter matrices in two
% different formats, for faces 4, 5, and 7.
[u,v] = meshgrid(0:0.2:1,0:0.2:1);
S1 = reshape([u(:) v(:)],1,36,2);
B1 = 7;
S2(1,:,:) = deal([u(:) v(:)]);
S2(2,:,:) = deal([u(:) v(:)]);
B2 = [4;5];
% Parameter values for the bounding edges of face 7, can be
% obtained by the following commands.
adj = geominfo(g3,'out','adj','odp',[1;2])
S3 = repmat(linspace(rng{2}(1,13),rng{2}(2,13),10),[4 1 1]);
B3 = find(adj{1}(:,7));
% Now, coordinate values of the faces and edges given above,
% together with coordinates for vertex 3, are obtained as follows.
[xx] = geominfo(g3,'out',{'xx'},...
'par',{{B1 S1} {B2 S2} {B3 S3} {3}})
% To see the obtained results, simply give the following commands.
hold on
plot3(xx{1}(:,:,1),xx{1}(:,:,2),xx{1}(:,:,3),'r.')
plot3(xx{3}(:,:,1),xx{3}(:,:,2),xx{3}(:,:,3),'b.')
% Finally, derivatives and curvatures, for both faces and edges are
% with the command below.
[dx,crv] = geominfo(g3,'out',{'dx' 'crv'},...
'par',{{B1 S1} {B3 S3}})
-----------------------
When the code reaches this portion:
[xx] = geominfo(g3,'out',{'xx'},...
'par',{{B1 S1} {B2 S2} {B3 S3} {3}})
MATLAB crashes. Any insight as to how I can fix this issue would be greatly appreciated. I am running COMSOL 3.5a and MATLAB r2009b on mac OS X 10.5.8.
Thanks,
Matt
3 Replies Last Post 2010年12月21日 GMT-5 23:46