You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

84 lines
2.1 KiB

function mp= Build_Cube_tmp()
% Bulid mp obj (contains models and all arguments)
%% init
pace=1*1.05;
Pst=[-2 0 -2]-1e-5;
Ped=[2 4 2];
Ped=FCM_dV.round_Ped(Pst,Ped,pace);
maxdeep=2;
order=3;
surf_order=-1;
objFile='./SHOW_DS/cube_4__sf.obj';
viewxy=[90 60];
Oa=[0 0 0];
Ra=[0 0 0];
rvec=(Ped-Pst)/pace
num_cells=rvec(1)*rvec(2)*rvec(3);
fprintf("num_cells: %.0f\n",num_cells);% show num of cells
%% add SS lib & python path
% SuiteSparse_paths2();
additon_path=pwd;
if count(py.sys.path,additon_path) == 0
insert(py.sys.path,int32(0),additon_path);
end
%% assemble c0
c=CSG("STL",[pwd,'/SolidWoks Files/Cube_tmp/cube_4.STL'],'init');
% c=CSG("Cube",'center',[0 2 0],[0 0 0],[2 2 2]);
V0=1;
% time and calculate Volume
tic
fcmv=FCM_V(Pst,Ped,pace,maxdeep,order,@c.calSF,@(X) ones(size(X,1),1));% |||1 dV
V0=fcmv.calIntegral_V();
fprintf('V0: %f ,Time: %f\n',V0,toc);
tic
fcmdv=FCM_dV(Pst,Ped,pace,maxdeep,order,@c.calSDF,@(X) ones(size(X,1),1));% ||1 dS
S0=fcmdv.calIntegral_S();
fprintf('S0: %f ,Time: %f\n',S0,toc);
%% build Dirichlet/Neumann boundary
Dirich_csg=CSG("Cube",'center',[0 0 0],Ra,[2 eps 2]);
% Dirich_csg.set_delta(0);
N0=CSG("Cube",'center',[0 4 0],Ra,[2 eps 2]);
Neuman_csg=N0;
tmpNeuf=[0 0 -1e-6 ];
Neuman_csg.fdv=@(X) repmat(tmpNeuf,size(X,1),1);
%% show model
clf;
c=c+(CSG("NULL")*Dirich_csg);
c.set_display_args(Pst,Ped,pace/2,'viewxy',viewxy);
c.saveAs('c');
c.display_csg();
%% init mp(save handle)
mp=ModelPlus(Pst,Ped,pace,order);
fprintf("Total Dofs: %.2f",mp.id_cnt*3);
mp.maxdeep=maxdeep;
mp.c=c;
mp.Dirich_csg=Dirich_csg;
mp.Neuman_csg=Neuman_csg;
mp.V0=V0;
% mp.delta=Dirich_csg.delta;
mp.viewxy=viewxy;
mp.objFile=objFile;
mp.surf_order=surf_order;
%% init fmt
tic
fmt=FeatureMappingTable(c,Pst,Ped,pace);
fmt.reflash_table();
tini=toc;
mp.recorder.time_maintain_fmt(end+1)=tini;
mp.fmt=fmt;
end