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.

95 lines
2.6 KiB

8 months ago
function mp= Build_Plate_tmp()
% Bulid mp obj (contains models and all arguments)
%% init
pace=0.5;
Pst=[0 0 0];
Ped=[4 4 0.5];
Ped=FCM_dV.round_Ped(Pst,Ped,pace);
maxdeep=5;
order=1;
surf_order=order;
% objFile='./SHOW_DS/cube_4__sf.obj';
% GSPW='NBC_GlobalGPW_for_plate';
viewxy=[90 60];
Neu_st=[4 0 0];
Neu_ed=Ped;
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",'/home/cflin/MatlabCode/TetWild/build/plate_r1.STL','init');
c=CSG('Cube','center',[2 2 0.5],Ra,[2 2 0.5])-CSG('Cylinder',[0 0 -1],Ra,1,3);
% time and calculate Volume
tic
fcmv=FCM_V(Pst,Ped,pace,maxdeep,order,@c.calSDF,@(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
% Dleft=CSG("Cube",'center',[0 2.5 0.5],Ra,[eps 1.5 0.5]);
Dleft=CSG("Cube",'center',[0 2 0.5],Ra,[eps 2 0.5]);
Dleft.direction=[1 0 0];
Ddown=CSG("Cube",'center',[2 0 0.5],Ra,[2 eps 0.5]);
Ddown.direction=[0 1 0];
Dbottom=CSG("Cube",'center',[2 2 0],Ra,[2 2 eps]);
Dbottom.direction=[0 0 1];
Dirich_csg=Dleft+Ddown+Dbottom;
Dirichlet_list=[Dleft Ddown Dbottom];
N0=CSG("Cube",'center',[4 2 0.5],Ra,[eps 2 0.5]);
Neuman_csg=N0;
tmpNeuf=[1e-3 0 0 ];
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/4,'viewxy',viewxy);
c.saveAs('c');
c.display_csg();
%% init mp(save handle)2
mp=ModelPlus(Pst,Ped,pace,order);
fprintf("Total Dofs: %.2f\n",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.surf_order=surf_order;
mp.Dirichlet_list=Dirichlet_list;
mp.Neu_st=Neu_st;
mp.Neu_ed=Neu_ed;
%% 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