-
Notifications
You must be signed in to change notification settings - Fork 17
/
importToastMesh.m
44 lines (44 loc) · 1.06 KB
/
importToastMesh.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function vmcmesh = importToastMesh(toastMesh)
%IMPORTTOASTMESH Imports a mesh from the Toast++ software suite
%
% USAGE:
%
% vmcmesh = importToastMesh(toastmesh)
%
% EXAMPLE:
%cd
% rad = 25;
% nsect = 6;
% nring = 32;
% nbnd = 2;
% [vtx,idx,eltp] = mkcircle(rad,nsect,nring,nbnd);
% toastmesh = toastMesh(vtx,idx,eltp);
% vmcmesh = importToastMesh(toastmesh);
%
% DESCRIPTION:
%
% This is a wrapper function that converts the data in
% an instance of the toastMesh class into the mesh structure
% of ValoMC.
%
% INPUT:
%
% toastmesh - toastMesh class
%
% OUTPUT:
%
% vmcmesh - vmcmesh structure
%
% This function is provided with ValoMC
%
if not(isa(toastMesh, 'toastMesh'))
error('Incorrect argument');
end
element=toastMesh.Element(1);
if(element.elid ~= 1)
error('Element type currently not supported');
end
[vmcmesh.r, vmcmesh.H] = toastMesh.Data();
[surfpoints,edges,perm]=toastMesh.SurfData;
vmcmesh.BH=[perm(edges(:,1)) perm(edges(:,2))];
end