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.
111 lines
2.4 KiB
111 lines
2.4 KiB
function mp= Build_testCube()
|
|
% Bulid mp obj (contains models and all arguments)
|
|
%% init
|
|
pace=2;
|
|
Pst=[-2 0 -2]-pace*0.52;
|
|
Ped=[2 4 2 ];
|
|
Ped=FCM_dV.round_Ped(Pst,Ped,pace);
|
|
maxdeep=6;
|
|
order=2;
|
|
viewxy=[0 60];
|
|
|
|
Shape.accessThreshold(pace/maxdeep/2/2/2);%
|
|
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/Piston28/piston28.STL'],'init');
|
|
c=CSG("Cube",'corner',[-2 0 -2],Ra,[4 4 4]);
|
|
V0=1;
|
|
% 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);
|
|
|
|
%% build Dirichlet/Neumann boundary
|
|
eepsD=3e-2;
|
|
eepsN=1.5e-2;
|
|
|
|
Dirich_csg=CSG("Cube",'corner',[-2 0 -2],Ra,[4 eps 4]);
|
|
Dirich_csg.judge_func=@(X) abs(X(:,2))<eepsD ;
|
|
%------------------------------------------Neu
|
|
|
|
Neuman_csg=CSG("Cube",'corner',[-2 4 -2],Ra,[4 eps 4]);
|
|
Neuman_csg.judge_func=@(X) abs(X(:,2)-4)<eepsN ;
|
|
Neuman_csg.fdv=@cal_NeuF;
|
|
|
|
% fcmdv=FCM_dV(Pst,Ped,pace,maxdeep,order,@c.calSDF,@(X) ones(size(X,1),1));% |||1 dV
|
|
% SD=fcmdv.calIntegral_S(Dirich_csg)
|
|
% SD_std=16;
|
|
% relaD=(SD-SD_std)/SD_std
|
|
%
|
|
% SN=fcmdv.calIntegral_S(Neuman_csg)
|
|
% SN_std=16;
|
|
% relaN=(SN-SN_std)/SN_std
|
|
|
|
%% show model
|
|
clf;
|
|
% c=c+(CSG("NULL")*Dirich_csg);
|
|
c.set_display_args(Pst,Ped,pace/3,'viewxy',viewxy);
|
|
c.saveAs('c');
|
|
c.display_csg();
|
|
|
|
%% init mp(save handle)
|
|
mp=ModelPlus(Pst,Ped,pace,order,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.E=2e11*1e-3;
|
|
mp.u=0.3;
|
|
|
|
if 1 && order<=3
|
|
saveKeH=SaveKe(mp,@compute_B_in_local,mp.pace,mp.order,mp);
|
|
mp.saveKe=saveKeH;
|
|
end
|
|
% mp.strongDBC=1;
|
|
% mp.strongNBC=1;
|
|
% mp.Neu_st=[-2 4 -2];
|
|
% mp.Neu_ed=[2 4 2];
|
|
%% set args here
|
|
mp.fixedNeu=1;
|
|
mp.fixedDir=1;
|
|
mp.iscontrast=0;
|
|
mp.isrecord=0;
|
|
|
|
%% 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
|
|
|
|
function ret=cal_NeuF(X)
|
|
ret=zeros(size(X))+[0 0 -1/16]*1e3;% tot 1 N
|
|
|
|
end
|
|
|