summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutr.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutr.cs')
-rw-r--r--Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutr.cs1197
1 files changed, 576 insertions, 621 deletions
diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutr.cs b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutr.cs
index 8f6a399f617..904f5dfd369 100644
--- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutr.cs
+++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindyliboutr.cs
@@ -14,7 +14,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>
//
-println("ketcindylibout(20181029 loaded");
+println("ketcindylibout(20181130 loaded");
//help:start();
@@ -48,6 +48,7 @@ WritetoS(fname,cmdL):=(
closefile(SCEOUTPUT);
);
+////%kcS start////
kcS(path,fname):=kcS(path,fname,[]);
kcS(path,fname,optionorg):=(
//help:kcS(PathS,"boxdata");
@@ -114,7 +115,11 @@ kcS(path,fname,optionorg):=(
closefile(SCEOUTPUT);
println(kc(Dirwork+Batparent,Dirlib,Fnametex));// 16.05.29, 0605
,
- SCEOUTPUT = openfile("kc.sh");
+ if(ismacosx(), //181125from
+ SCEOUTPUT = openfile("kc.command");
+ ,
+ SCEOUTPUT = openfile("kc.sh");
+ ); //181125to
println(SCEOUTPUT,"#!/bin/sh");
println(SCEOUTPUT,"cd "+Dq+Dirwork+Dq);
tmp=Dq+path+Dq+" -nwni -f "+filename;
@@ -127,6 +132,7 @@ kcS(path,fname,optionorg):=(
setdirectory(Dirwork);
);
);
+////%kcS end////
SetpathS():=(
regional(tmp,tmp1);
@@ -209,29 +215,29 @@ CalcbyS(name,path,cmd,optionorg):=(
wfile="";
forall(eqL,
tmp=indexof(#,"=");
- tmp1=Toupper(substring(#,0,2));
+ tmp1=Toupper(substring(#,0,1));
tmp2=substring(#,tmp,length(#));
- if(tmp1=="CA",
+ if(tmp1=="C",
cat=Toupper(substring(tmp2,0,1));// 16.11.24
options=remove(options,[#]);
);
- if(tmp1=="NC",
+ if(tmp1=="N",
ncoL=parse(tmp2);
options=remove(options,[#]);
);
- if(tmp1=="EX",
+ if(tmp1=="E",
if(indexof(tmp2,".")==0,ext="."+tmp2,ext=tmp2);
options=remove(options,[#]);
);
- if(tmp1=="WA",
+ if(tmp1=="W",
waiting=parse(tmp2);
options=remove(options,[#]);
);
- if(tmp1=="DI",
+ if(tmp1=="D",
dig=parse(tmp2);
options=remove(options,[#]);
);
- if(tmp1=="FI", // 16.06.26from
+ if(tmp1=="F", // 16.06.26from
wfile=tmp2;
options=remove(options,[#]);
); // 16.06.26until
@@ -442,9 +448,9 @@ Scifun(name,fun,argL,optionorg):=(
eqL=tmp_5;
forall(eqL,
tmp=indexof(#,"=");
- tmp1=Toupper(substring(#,0,3));
+ tmp1=Toupper(substring(#,0,1)); //181111
tmp2=substring(#,tmp,length(#));
- if((tmp1=="DIS") % (tmp1=="DSP") ,
+ if(tmp1=="D" ,
tmp=Toupper(substring(tmp2,0,1));
if((tmp=="F") % (tmp=="N"),
disp=0;
@@ -602,7 +608,11 @@ kcR(path,fname,optionorg):=(
closefile(SCEOUTPUT);
println(kc(Dirwork+Batparent,Dirlib,Fnametex));// 16.05.29,06.05
,
- SCEOUTPUT = openfile("kc.sh");
+ if(ismacosx(), //181125from
+ SCEOUTPUT = openfile("kc.command");
+ ,
+ SCEOUTPUT = openfile("kc.sh");
+ ); //181125to
println(SCEOUTPUT,"#!/bin/sh");
println(SCEOUTPUT,"cd "+Dq+Dirwork+Dq);
if(PathR=="",tmp="R",tmp=PathR);//16.10.20
@@ -730,6 +740,7 @@ MkprecommandR(prec,chstr):=(
cmdL;
);
+////%CalcbyR start////
CalcbyR(name,cmd):=CalcbyR(name,PathR,cmd,[]);
CalcbyR(name,Arg1,Arg2):=(
if(isstring(Arg1),
@@ -740,7 +751,7 @@ CalcbyR(name,Arg1,Arg2):=(
);
CalcbyR(name,path,cmd,optionorg):=(
//help:CalcbyR(name,cmd);
-//help:CalcbyR(options=["m/r","Wait=2","Out=yes","Pre=PVOFG","Res=" ]);
+//help:CalcbyR(options=["m/r","Wait=2","Out=y/n","Pre=PVOFG"]);
//help:CalcbyR(options2=["Pre=!G" ]);
regional(options,tmp,tmp1,tmp2,tmp3,realL,strL,eqL,
cat,dig,prestr,flg,wflg,file,nc,arg,cmdR,cmdlist,wfile,waiting);
@@ -750,7 +761,17 @@ CalcbyR(name,path,cmd,optionorg):=(
realL=tmp_6;
strL=tmp_7;
dig=5;
- cat="Y";
+ tmp=cmd_(length(cmd)-1); //181130from
+ if(indexof(tmp,"=")+indexof(tmp,"::")>0,
+ cat="Y";
+ ,
+ tmp=cmd_(length(cmd));
+ if(length(tmp)>0,
+ cat="Y";
+ ,
+ cat="N";
+ );
+ ); //181130to
wfile="";
prestr="PVOFG"; //180508
waiting=30; //180608
@@ -1056,6 +1077,7 @@ CalcbyR(name,path,cmd,optionorg):=(
);
);
);
+////%CalcbyR end////
Rfun(name,fun,argL):=Rfun(name,fun,argL,[]);//16.10.22
Rfun(name,fun,argL,optionorg):=(
@@ -1074,9 +1096,9 @@ Rfun(name,fun,argL,optionorg):=(
eqL=tmp_5;
forall(eqL,
tmp=indexof(#,"=");
- tmp1=Toupper(substring(#,0,3));
+ tmp1=Toupper(substring(#,0,1)); //181111
tmp2=substring(#,tmp,length(#));
- if((tmp1=="DIS") % (tmp1=="DSP") ,
+ if(tmp1=="D",
tmp=Toupper(substring(tmp2,0,1));
if((tmp=="F") % (tmp=="N"),
disp=0;
@@ -1099,6 +1121,7 @@ Rfun(name,fun,argL,optionorg):=(
parse(nm);
);
+////%Readcsv start////
Readcsv(file):=Readcsv(Dirwork,file,[]);
Readcsv(Arg1,Arg2):=(
if(isstring(Arg2),
@@ -1108,9 +1131,9 @@ Readcsv(Arg1,Arg2):=(
);
);
Readcsv(pathorg,file,optionorg):=(
-//help:Readcsv("ex.csv");
-//help:Readcsv(directory,"ex.csv");
-//help:Readcsv(options=["Head=yes","Sep=-999","Flat=no","Use=R"]);
+// help:Readcsv("ex.csv");
+// help:Readcsv(directory,"ex.csv");
+// help:Readcsv(options=["Head=yes","Sep=-999","Flat=no","Use=R"]);
regional(path,fname,fout,options,eqL,header,cmdL,sep,
dt,nrow,tmp,tmp1,tmp2,csv,use,flat);
options=optionorg;
@@ -1125,31 +1148,31 @@ Readcsv(pathorg,file,optionorg):=(
tmp=indexof(#,"=");
tmp1=substring(#,0,tmp-1);
tmp2=substring(#,tmp,length(#));
- tmp=Toupper(substring(tmp1,0,2));
- if(tmp=="HE",
+ tmp=Toupper(substring(tmp1,0,1)); //181111
+ if(tmp=="H",
tmp=Toupper(substring(tmp2,0,1));
if(tmp=="F" % tmp=="N",
header=0;
options=remove(options,[#]);
);
);
-// if(tmp=="WA", // removed:17.02.19
+// if(tmp=="W", // removed:17.02.19
// waiting=parse(tmp2);
// options=remove(options,[#]);
// );
- if(tmp=="SE",
+ if(tmp=="S",
sep=tmp2;
options=remove(options,[#]);
);
- if(tmp=="CS",
+ if(tmp=="C",
csv=Toupper(substring(tmp2,0,1));
options=remove(options,[#]);
);
- if(tmp=="US",
+ if(tmp=="U",
use=Toupper(substring(tmp2,0,1));
options=remove(options,[#]);
);
- if(tmp=="FL",
+ if(tmp=="F",
flat=Toupper(substring(tmp2,0,1));
options=remove(options,[#]);
);
@@ -1239,6 +1262,22 @@ Readcsv(pathorg,file,optionorg):=(
);
);
);
+// New readcsv (181125)
+Readcsv(file):=Readcsv(Dirwork,file);
+Readcsv(path,file):=(
+//help:Readcsv("ex.csv");
+//help:Readcsv(directory,"ex.csv");
+//help:Readcsv(options=["Head=yes","Sep=-999","Flat=no","Use=R"]);
+ regional(dt);
+ dt=readfile2str(path,file);
+ dt=tokenize(dt,"/LF/");
+ if(dt_(length(dt))=="",
+ dt=dt_(1..(length(dt)-1));
+ );
+ dt=apply(dt,tokenize(#,","));
+ dt;
+);
+////%Readcsv end////
Writecsv(nmL,data,file):=Writecsv(nmL,data,file,[]);
Writecsv(nmL,dataorg,file,optionorg):=(
@@ -1459,6 +1498,7 @@ PlotdataR(name1,path,func,variable,optionorg):=(
);
////%PlotdataR end////
+////%PlotdiscR start////
PlotdiscR(nm,fun,varrng):=PlotdiscR(nm,fun,varrng,[]);
PlotdiscR(nm,fun,varrng,options):=(
//help:PlotdiscR("1","dbinom(k,10,0.4)","k=[0,10]");
@@ -1489,7 +1529,9 @@ PlotdiscR(nm,fun,varrng,options):=(
Listplot(name,tmp,options);
);
);
+////%PlotdiscR end////
+////%Boxplot start////
Boxplot(nm,dataorg,ypos,dy):=Boxplot(nm,dataorg,ypos,dy,[]);
Boxplot(nm,dataorg,ypos,dy,optionorg):=(
//help:Boxplot("1",dt,2,1/2,[""]);
@@ -1648,7 +1690,9 @@ Boxplot(nm,dataorg,ypos,dy,optionorg):=(
[bp_(1..5),out];
);
);
+////%Boxplot end////
+////%Histplot start//
Histplot(nm,dataorg):=Histplot(nm,dataorg,[]);
Histplot(nm,dataorg,optionorg):=(
//help:Histplot("1",data(fillename));
@@ -1665,11 +1709,11 @@ Histplot(nm,dataorg,optionorg):=(
relative=0;
waiting=3;
forall(eqL,
- tmp=indexof(#,"=");
- tmp1=substring(#,tmp,length(#));
- if(Toupper(substring(#,0,1))=="B",
- if(substring(tmp1,0,1)=="[",
- tmp1="c("+substring(tmp1,1,length(tmp1)-1)+")";
+ tmp=Strsplit(#,"=");
+ tmp1=Toupper(substring(tmp_1,0,1));
+ if(tmp1=="B",
+ if(substring(tmp_2,0,1)=="[",
+ tmp1="c("+substring(tmp_2,1,length(tmp_2)-1)+")"; //181104
);
breaks="breaks="+tmp1;
options=remove(options,[#]);
@@ -1827,6 +1871,7 @@ Histplot(nm,dataorg,optionorg):=(
[bdata,cdata];
);
);
+////%Histplot end//
////%Scatterplot start////
Scatterplot(nm,file):=Scatterplot(nm,file,[],[]);
@@ -2338,6 +2383,7 @@ WritetoA(fname,cmdL):=(
closefile(SCEOUTPUT);
);
+////%kcA start////
kcA(fname):=kcA(fname,[]);
kcA(fname,optionorg):=(
//help:kcA("boxdata");
@@ -2407,7 +2453,11 @@ kcA(fname,optionorg):=(
tmp=replace(filename,".rr",".txt");
println(kc(Dirwork+Batparent,Dirlib,tmp)); // 16.05.29,06.05
,
- SCEOUTPUT = openfile("kc.sh");
+ if(ismacosx(), //181125from
+ SCEOUTPUT = openfile("kc.command");
+ ,
+ SCEOUTPUT = openfile("kc.sh");
+ ); //181125to
println(SCEOUTPUT,"#!/bin/sh");
println(SCEOUTPUT,"cd "+Dq+Dirwork+Dq);
tmp="rm "+replace(filename,".rr",".txt");
@@ -2424,7 +2474,9 @@ kcA(fname,optionorg):=(
setdirectory(Dirwork);
);
);
+////%kcA end////
+////%CalcbyA start////
CalcbyA(name,cmd):=CalcbyA(name,cmd,[]);
CalcbyA(name,cmd,optionorg):=(
//help:CalcbyA("a",cmd);
@@ -2611,6 +2663,7 @@ CalcbyA(name,cmd,optionorg):=(
println(" CalcbyA succeeded "+name+" ("+text(tmp2)+" sec)");
);
);
+////%CalcbyA end////
AsfunO(name,fun,argL):=AsirfunO(name,fun,argL); // 16.02.03
AsfunO(name,fun,argL,options):=AsirfunO(name,fun,argL,options);
@@ -2625,9 +2678,9 @@ AsirfunO(name,fun,argLorg,options):=(
argL=argLorg;
forall(eqL,
tmp=indexof(#,"=");
- tmp1=Toupper(substring(#,0,3));
+ tmp1=Toupper(substring(#,0,1));
tmp2=substring(#,tmp,length(#));
- if(tmp1=="PRO", // 16.05.26from
+ if(tmp1=="P", // 16.05.26from
tmp=Toupper(substring(tmp2,0,1));
if((tmp=="T") % (tmp=="Y"),
tmp1=argL_(length(argL));
@@ -2654,13 +2707,13 @@ Asirfun(name,fun,argL,optionorg):=(
eqL=tmp_5;
forall(eqL,
tmp=indexof(#,"=");
- tmp1=Toupper(substring(#,0,3));
+ tmp1=Toupper(substring(#,0,1)); //181111
tmp2=substring(#,tmp,length(#));
- if(tmp1=="PRE",
+ if(tmp1=="P",
precise=parse(tmp2);
options=remove(options,[#]);
);
- if((tmp1=="DIS") % (tmp1=="DSP"),
+ if(tmp1=="D",
tmp=Toupper(substring(tmp2,0,1));
if((tmp=="F") % (tmp=="N"),
disp=0;
@@ -2772,6 +2825,7 @@ WritetoM(fname,cmdL,allflg):=(
closefile(SCEOUTPUT);
);
+////%kcM start////
kcM(fname):=kcM(fname,[]);
kcM(fname,optionorg):=(
//help:kcM("boxdata");
@@ -2852,7 +2906,11 @@ kcM(fname,optionorg):=(
tmp=replace(filename,".max",".txt");
println(kc(Dirwork+Batparent,Mackc+Dirlib,tmp));// 16.05.29,06.05
,
- SCEOUTPUT = openfile("kc.sh");
+ if(ismacosx(), //181125from
+ SCEOUTPUT = openfile("kc.command");
+ ,
+ SCEOUTPUT = openfile("kc.sh");
+ ); //181125to
println(SCEOUTPUT,"#!/bin/sh");
println(SCEOUTPUT,"cd "+Dq+Dirwork+Dq);
tmp="rm "+replace(filename,".max",".txt");
@@ -2868,7 +2926,9 @@ kcM(fname,optionorg):=(
setdirectory(Dirwork);
);
);
+////%kcM end////
+////%CalcbyM start////
CalcbyM(name,cmd):=CalcbyM(name,cmd,[]);
CalcbyM(name,cmd,optionorg):=(
//help:CalcbyM("a",cmdL);
@@ -3127,7 +3187,9 @@ CalcbyM(name,cmd,optionorg):=(
);
);
);
+////%CalcbyM end////
+////%Mxfun start////
Mxfun(name,fun,argL):=Mxfun(name,fun,argL,[]);
Mxfun(name,fun,argL,optionorg):=(
//help:Mxfun("ca1","diff",["sin(x)^3","x"],[""]);
@@ -3144,13 +3206,13 @@ Mxfun(name,fun,argL,optionorg):=(
eqL=tmp_5;
forall(eqL,
tmp=indexof(#,"=");
- tmp1=Toupper(substring(#,0,3));
+ tmp1=Toupper(substring(#,0,1));
tmp2=substring(#,tmp,length(#));
- if(tmp1=="PRE",
+ if(tmp1=="P",
precise=parse(tmp2);
options=remove(options,[#]);
);
- if((tmp1=="DIS") % (tmp1=="DSP") ,
+ if(tmp1=="DIS" ,
tmp=Toupper(substring(tmp2,0,1));
if((tmp=="F") % (tmp=="N"),
disp=0;
@@ -3195,7 +3257,9 @@ Mxfun(name,fun,argL,optionorg):=(
);
parse(nm);
);
+////%Mxfun end////
+////%Mxtex start////
Mxtex(nm,ex):=Mxtex(nm,ex,[]);
Mxtex(nm,ex,optionorg):=(
//help:Mxtex("1","sin(x)/x");
@@ -3210,9 +3274,9 @@ Mxtex(nm,ex,optionorg):=(
set=[];
forall(eqL,
tmp=indexof(#,"=");
- tmp1=Toupper(substring(#,0,3));
+ tmp1=Toupper(substring(#,0,1));
tmp2=substring(#,tmp,length(#));
- if((tmp1=="DIS") % (tmp1=="DSP") ,
+ if(tmp1=="D" ,
tmp=Toupper(substring(tmp2,0,1));
if((tmp=="F") % (tmp=="N"),
disp=0;
@@ -3257,7 +3321,9 @@ Mxtex(nm,ex,optionorg):=(
parse(tmp);
out;
);
+////%Mxtex end////
+////%MxtexL start////
MxtexL(nm,exlist):=MxtexL(nm,exlist,[]); // 16.05.27
MxtexL(nm,exlist,options):=(
regional(out,tmp,tmp1);
@@ -3287,7 +3353,9 @@ Mxbatch(file):=(
);
out;
);
+////%MxtexL end////
+////%Mxload start////
Mxload(file):=( //17.06.16
//help:Mxload(["rkfun.lispp"]);
regional(figL,out,path,tmp,tmp1,tmp2);
@@ -3302,7 +3370,9 @@ Mxload(file):=( //17.06.16
);
out;
);
+////%Mxload end////
+////%Maxima2Cindydata start////
Maxima2Cindydata(str):=( //17.10.24
regional(out,numstr,eL,nn,ne,flg,tmp);
numstr="-0123456789";
@@ -3333,7 +3403,9 @@ Maxima2Cindydata(str):=( //17.10.24
);
parse(out);
);
+////%Maxima2Cindydata end////
+////%kcV3 start////
kcV3(fname):=kcV3(Dirwork,fname);
kcV3(path,fname):=(
//help:kcV3(path,"ex.obj");
@@ -3363,7 +3435,11 @@ kcV3(path,fname):=(
closefile(SCEOUTPUT);
println(kc(Dirwork+Batparent,Dirlib,Fnametex));// 16.05.29,06.05
,
- SCEOUTPUT = openfile("kc.sh");
+ if(ismacosx(), //181125from
+ SCEOUTPUT = openfile("kc.command");
+ ,
+ SCEOUTPUT = openfile("kc.sh");
+ ); //181125to
println(SCEOUTPUT,"#!/bin/sh");
println(SCEOUTPUT,"cd "+Dq+Dirwork+Dq);
tmp=Dq+PathV3+Dq+" "+tmp1+filename;
@@ -3379,6 +3455,7 @@ kcV3(path,fname):=(
);
);
+////%Changeobjscale start////
Changeobjscale(fname):=(
regional(fout);
fout=replace(fname,".obj","");
@@ -3478,7 +3555,9 @@ Changeobjscale(unitlen,fnameorg,foutorg,optionorg):=(
CalcbyR("cs",cmdL,options);
println("Scale of "+fname+" changed");
);
+////%Changeobjscale end////
+////%Mkviewobj start////
Mkviewobj(fname,cmdL):=Mkviewobj(Dirwork,fname,cmdL,[]);
Mkviewobj(Arg1,Arg2,Arg3):=(
if(!isstring(OCNAME), //17.04.13from
@@ -3496,9 +3575,10 @@ Mkviewobj(pathorg,fnameorg,cmdLorg,optionorg):=(
//help:Mkviewobj(fname,cmdlist);
//help:Mkviewobj(fname,[]);
//help:Mkviewobj(path,fname,cmdlist);
-//help:Mkviewobj(options=["M/R","V","Unit=in","Wait=5"]);
+//help:Mkviewobj(options=["M/R","V","Unit=in","Wait=(10)"]);
regional(path,cmdL,eqL,strL,flg,fname,options,make,view,cmdlist,
- vtx,face,unit,tmp,tmp1,tmp2);
+ vtx,face,unit,tmp,tmp1,tmp2,store);
+ store=Fillblack(); //181128
path=replace(pathorg,"\","/");
if(substring(path,length(path)-1,length(path))!="/",path=path+"/");
fname=fnameorg;
@@ -3569,13 +3649,12 @@ Mkviewobj(pathorg,fnameorg,cmdLorg,optionorg):=(
cmdlist=MkprecommandR();
cmdlist=concat(cmdlist,["Openobj",[Dq+path+fname+Dq]]);
cmdlist=concat(cmdlist,cmdL);
- tmp=["Closeobj()",[],""+Dq+"||||"+Dq,[]];//16.12.26
+ tmp=["Closeobj()",[]];//181130
cmdlist=concat(cmdlist,tmp);
- tmp=append(options,"Cat=y");
- tmp1=apply(tmp,Toupper(substring(#,0,1))); // 16.04.23from
+ tmp1=apply(options,Toupper(substring(#,0,1))); // 16.04.23from
tmp1=select(tmp1,#=="W");
if(length(tmp1)==0,
- tmp=append(tmp,"Wait=5");
+ tmp=append(tmp,"Wait=10");
);// 16.04.23to
CalcbyR("",cmdlist,tmp); //180902
wait(WaitUnit*100); // 16.03.18
@@ -3617,8 +3696,11 @@ Mkviewobj(pathorg,fnameorg,cmdLorg,optionorg):=(
ViewFile=fname;
); // 16.03.14 until
);
+ Fillrestore(store); //181128
);
+////%Mkviewobj end////
+////%Setobj start////
//Objname(str):=Objname(str,["m","v"]); //180906from
//Objname(str,options):=Setobj(str,options);
Setobj():=Setobj(Fhead,["m","v"]); //180901
@@ -3646,7 +3728,9 @@ Setobj(str,optionsorg):=( //180906to
); //17.12.23until
println("generate OBJCMD. name="+OCNAME+", option="+OCOPTION);
);
+////%Setobj end////
+////%Mkobjcmd start////
Mkobjcmd(nm,fd):=Mkobjcmd(nm,fd,[40,40,"+"]);
Mkobjcmd(nm,fd,options):=(
//help:Mkobjcmd("1",fd,[40,40,"+"]);
@@ -3698,7 +3782,9 @@ Mkobjcmd(nm,fd,options):=(
OBJCMD=concat(OBJCMD,out);//16.11.29
out;
);
+////%Mkobjcmd end////
+////%Mkobjnrm start////
Mkobjnrm(nm,fd):=Mkobjnrm(nm,fd,[]);
Mkobjnrm(nm,fd,optionorg):=(
//help:Mkobjnrm("1",fd1,["Disp=y"]);
@@ -3792,7 +3878,9 @@ Mkobjnrm(nm,fd,optionorg):=(
); // 16.05.02until
out;
);
+////%Mkobjnrm end////
+////%Mkobjthickcmd start////
Mkobjthickcmd(nm,fd):=Mkobjthickcmd(nm,fd,"",[40,40,"+"]);
Mkobjthickcmd(nm,fd,Arg):=(
if(islist(Arg),
@@ -3898,7 +3986,10 @@ Mkobjthickcmd(nm,fd,fnrm,optionorg):=(
OBJCMD=concat(OBJCMD,out);//16.11.29
out;
);
+////%Mkobjthickcmd end////
+
+////%Mkobjpolycmd start////
Mkobjpolycmd(nm,pd):=Mkobjpolycmd(nm,pd,[]);
Mkobjpolycmd(nm,pd,optionorg):=(
//help:Mkobjpolycmd("1",pd);
@@ -3968,7 +4059,9 @@ Mkobjpolycmd(nm,pd,optionorg):=(
OBJCMD=concat(OBJCMD,out);//16.11.29
out;
);
+////%Mkobjpolycmd end////
+////%Mkobjplatecmd start////
Mkobjplatecmd(nm,pd):=Mkobjplatecmd(nm,pd,[]);
Mkobjplatecmd(nm,pdorg,optionorg):=( // 16.06.18
//help:Mkobjplatecmd("1",pd);
@@ -4045,7 +4138,9 @@ Mkobjplatecmd(nm,pdorg,optionorg):=( // 16.06.18
OBJCMD=concat(OBJCMD,out);//16.11.29
out;
);
+////%Mkobjplatecmd end////
+////%Mkobjcrvcmd start////
Mkobjcrvcmd(nm,pst):=Mkobjcrvcmd(nm,pst,[]);
Mkobjcrvcmd(nm,pstorg,options):=(
//help:Mkobjcrvcmd("1","sc3d1",[0.02,6,"xy"]);
@@ -4117,7 +4212,9 @@ Mkobjcrvcmd(nm,pstorg,options):=(
OBJCMD=concat(OBJCMD,out);//16.11.29
out;
);
+////%Mkobjcrvcmd end////
+////%Mkobjsymbcmd start////
Mkobjsymbcmd(symb,size,rot,dir,pos):=
Mkobjsymbcmd("",symb,size,rot,dir,pos,[]);
Mkobjsymbcmd(Ar1,Ar2,Ar3,Ar4,Ar5,Ar6):=(
@@ -4246,7 +4343,9 @@ Mkobjsymbcmd(path,symborg,size,rot,dir,pos,optionorg):=(
OBJCMD=concat(OBJCMD,out);//16.11.29
out;
);
+////%Mkobjsymbcmd end////
+////%Concatcmd start////
Concatcmd(cmdlist):=(
//help:Concatcmd([cmdL1,cmdL2]);
regional(out);
@@ -4256,6 +4355,7 @@ Concatcmd(cmdlist):=(
);
out;
);
+////%Concatcmd end////
WritetoF(fname,cmdL):=(
// help:WritetoF("outdata",cmdL);
@@ -4353,7 +4453,12 @@ kcF(fname,optionorg):=(
println(SCEOUTPUT,tmp);
println(SCEOUTPUT,"exit 0");
closefile(SCEOUTPUT);
- SCEOUTPUT = openfile("kc.sh");
+ ,
+ if(ismacosx(), //181125from
+ SCEOUTPUT = openfile("kc.command");
+ ,
+ SCEOUTPUT = openfile("kc.sh");
+ ); //181125to
Lf=unicode("10",base->10);
print(SCEOUTPUT,"#!/bin/sh"+Lf);
tmp1=replace(Dirwork,"\","/");
@@ -4373,7 +4478,11 @@ kcF(fname,optionorg):=(
closefile(SCEOUTPUT);
println(kc(Dirwork+Batparent,Dirlib,Fnametex));// 16.05.29,06.05
,
- SCEOUTPUT = openfile("kc.sh");
+ if(ismacosx(), //181125from
+ SCEOUTPUT = openfile("kc.command");
+ ,
+ SCEOUTPUT = openfile("kc.sh");
+ ); //181125to
println(SCEOUTPUT,"#!/bin/sh");
println(SCEOUTPUT,"cd "+Dq+Dirwork+Dq);
tmp=Dq+PathF+Dq+" -nox -eval "+Dq+")read "+filename+Dq;
@@ -4586,9 +4695,9 @@ Frifun(name,fun,argL,optionorg):=(
eqL=tmp_5;
forall(eqL,
tmp=indexof(#,"=");
- tmp1=Toupper(substring(#,0,3));
+ tmp1=Toupper(substring(#,0,1));
tmp2=substring(#,tmp,length(#));
- if((tmp1=="DIS") % (tmp1=="DSP") ,
+ if(tmp1=="D" ,
tmp=Toupper(substring(tmp2,0,1));
if((tmp=="F") % (tmp=="N"),
disp=0;
@@ -4745,13 +4854,14 @@ Mkketcindyjs(libname,options):=( //17.11.18
///////////////// C function //////////////////
-Cform(strorg):=(
+Cformold(strorg):=(
//help:Cform(str);
- regional(str,ter,out,hat,ns,ne,nn,jj,flg,
+ regional(str,ter,out,hat,pare,ns,ne,nn,jj,flg,flg2,
lv,str1,str2,tmp,tmp1,tmp2);
ter=["+","-","*","/","(",")","="]; //180517
str=replace(strorg,"pi","M_PI");
hat=Indexall(str,"^");
+ pare=Bracket(str,"()");
out="";
ns=0;
forall(hat,nn,
@@ -4841,6 +4951,104 @@ Cform(strorg):=(
out;
);
+////%Cform start////
+Cform(strorg):=( //181106
+//help:Cform(str);
+ regional(str,str2,out,ter,num,hat,pare,jj,ns,ne,nsa,nea,flg,flg2,tmp,tmp1,tmp2);
+ ter=["+","-","*","/","(",")","="]; //180517
+ str=replace(strorg,"pi","M_PI");
+ num=apply(0..9,text(#)); //181107from
+ num=append(num,".");
+ flg=0;
+ tmp1=str+"/";
+ tmp2="";
+ str="";
+ forall(1..(length(tmp1)),
+ tmp=substring(tmp1,#-1,#);
+ if(contains(num,tmp),
+ if(flg==0,
+ tmp2=tmp;
+ flg=1;
+ ,
+ tmp2=tmp2+tmp;
+ );
+ ,
+ if(flg==1,
+ if(indexof(tmp2,".")==0, tmp2=tmp2+".0");
+ str=str+tmp2+tmp;
+ flg=0;
+ ,
+ str=str+tmp;
+ );
+ );
+ );
+ str=substring(str,0,length(str)-1); //181107to
+ out="";
+ flg=0;
+ forall(1..100,jj,
+ if(flg==0,
+ hat=indexof(str,"^");
+ if(hat==0,
+ out=out+str;
+ flg=1;
+ ,
+ ne=hat-1;
+ if(substring(str,ne-1,ne)==")",
+ ne=ne-1;
+ pare=Bracket(str,"()");
+ tmp=select(pare,#_1==hat-1);
+ tmp=tmp_1_2;
+ tmp1=select(pare,(#_1<hat)&(#_2==-tmp));
+ ns=tmp1_(length(tmp1))_1+1;
+ nsa=ns-1;
+ ,
+ flg2=0;
+ forall(reverse(1..ne),
+ if(flg2==0,
+ if(contains(ter,substring(str,#-1,#)),
+ ns=#+1;
+ flg2=1;
+ );
+ );
+ );
+ if(flg2==0,ns=1);
+ nsa=ns;
+ );
+ str2="pow("+substring(str,ns-1,ne)+",";
+ ns=hat;
+ if(substring(str,ns,ns+1)=="(",
+ ns=ns+2;
+ pare=Bracket(str,"()");
+ tmp=select(pare,#_1==hat+1);
+ tmp=tmp_1_2;
+ tmp1=select(pare,(#_1>hat)&(#_2==-tmp));
+ ne=tmp1_1_1-1;
+ nea=ne+1;
+ ,
+ ns=ns+1;
+ flg2=0;
+ forall(ns..(length(str)),
+ if(flg2==0,
+ if(contains(ter,substring(str,#-1,#)),
+ ne=#-1;
+ flg2=1;
+ );
+ );
+ );
+ if(flg2==0,ne=length(str));
+ nea=ne;
+ );
+ str2=str2+substring(str,ns-1,ne)+")";
+ out=out+substring(str,0,nsa-1)+str2;
+ str=substring(str,nea,length(str));
+ );
+ );
+ );
+ out;
+);
+////%Cform end////
+
+////%ConvertFdtoC start////
ConvertFdtoC(Fd):=ConvertFdtoC(Fd,["x","y","z"]);
ConvertFdtoC(Fd,name):=(
//help:ConvertFd(Fd);
@@ -4857,9 +5065,12 @@ ConvertFdtoC(Fd,name):=(
FdC=concat(FdC,[Cform(tmp1_4),Cform(tmp1_5)]);
FdC=concat(FdC,[tmp1_6]);
);
+////%ConvertFdtoC end////
+////%Startsurf start////
Startsurf():=StartsurfC();
Startsurf(Arg):=StartsurfC(Arg);
+Startsurf(Nplist,Dsizelist,Epslist):=StartsurfC("",Nplist,Dsizelist,Epslist); //181116
Startsurf(restr,Nplist,Dsizelist,Epslist):=StartsurfC(restr,Nplist,Dsizelist,Epslist);
StartsurfC():=StartsurfC("",[50,50],[1500,500,200],[0.01,0.1]);//180611renewed
StartsurfC(Arg):=(
@@ -4886,6 +5097,7 @@ StartsurfC(restr,Nplist,Dsizelist,Epslist):=(//180501
//help:Startsurf([50,50],[1500,500,200],[0.01,0.1]);
//help:Startsurf([50],[1500,500],[0.01,0.1]);
regional(divL,sizeL,epsL);
+ StyleListC=[]; //181107
CommandListC=[];//180608(2lines)
FuncListC=[];
if(substring(restr,0,1)=="R", //180611(3lines)
@@ -4903,511 +5115,24 @@ StartsurfC(restr,Nplist,Dsizelist,Epslist):=(//180501
epsL=prepend(0.00001,epsL);
ConstantListC=[divL,sizeL,epsL];
);
+////%Startsurf end////
-Cheader():=Cheader(FdC,FheadC+"header.h");
-Cheader(fdc,fname):=(
- regional(tmp,tmp1,tmp2,j, dW,dE,dS,dN,dstr,
- DsizeLL,DsizeL,DsizeM,DsizeS,Eps,Eps1,Eps2,Eps3);
- Mdv=50; Ndv=50;
- DsizeLL=15000; DsizeL=1500; DsizeM=500; DsizeS=200;
- Eps=0.00001; Eps1=0.05; Eps2=0.2; Eps3=1;
- SCEOUTPUT = openfile(fname);
- tmp=indexof(fdc_2,"=");
- tmp1=substring(fdc_2,tmp,length(fdc_2));
- tmp1=replace(tmp1,"[","{");
- tmp1=replace(tmp1,"]","}");
- tmp=indexof(fdc_3,"=");
- tmp2=substring(fdc_3,tmp,length(fdc_3));
- tmp2=replace(tmp2,"[","{");
- tmp2=replace(tmp2,"]","}");
- tmp="const double Urng[2]="+tmp1+", Vrng[2]="+tmp2;
- println(SCEOUTPUT,tmp+";");
- tmp="const double XMIN="+Sprintf(XMIN,6);
- tmp=tmp+",XMAX="+Sprintf(XMAX,6);
- println(SCEOUTPUT,tmp+";");
- tmp="const double THETA="+Sprintf(THETA,6);
- tmp=tmp+",PHI="+Sprintf(PHI,6);
- println(SCEOUTPUT,tmp+";");
- tmp=" //THETA:"+Sprintf(THETA*180/pi,2);
- tmp=tmp+", PHI:"+Sprintf(PHI*180/pi,2);
- println(SCEOUTPUT,tmp+";");
- dstr=fdc_4;
- if(indexof(dstr,"w")>0,dW=1,dW=0);
- if(indexof(dstr,"e")>0,dE=1,dE=0);
- if(indexof(dstr,"s")>0,dS=1,dS=0);
- if(indexof(dstr,"n")>0,dN=1,dN=0);
- tmp="const int DrawW="+text(dW)+", DrawE="+text(dE);
- tmp=tmp+", DrawS="+text(dS)+", DrawN="+text(dN);
- println(SCEOUTPUT,tmp+";");
- forall(j=5..(length(fdc)),
- tmp=fdc_#; //17.05.21from
- if(length(tmp)==2,
- if(tmp_1>1, //17.05.24from
- Mdv=tmp_1; Ndv=tmp_2;
- ,
- if(length(tmp_1)>0, Eps1=tmp_1);
- if(length(tmp_1)>0, Eps2=tmp_2);
- ); //17.05.24until
- );
- if(length(tmp)==3,
- if(length(tmp_1)>0, DsizeLL=tmp_1);//17.06.09(3lines)
- if(length(tmp_2)>0, DsizeL=tmp_2);
- if(length(tmp_3)>0, DsizeM=tmp_3);
- );
- if(length(tmp)==4,
- if(min(tmp)<1,
- if(length(tmp_1)>0, Eps=tmp_1);
- if(length(tmp_2)>0, Eps1=tmp_2);
- if(length(tmp_3)>0, Eps2=tmp_3);
- if(length(tmp_4)>0, Eps3=tmp_4);
- ,
- if(length(tmp_1)>0, DsizeLL=tmp_1);
- if(length(tmp_2)>0, DsizeL=tmp_2);
- if(length(tmp_3)>0, DsizeM=tmp_3);
- if(length(tmp_4)>0, DsizeS=tmp_4);
- )
- );//17.05.21until
- );
- tmp1=text(fdc_5_1);
- tmp2=text(fdc_5_2);
- tmp="const int Mdv="+text(Mdv)+", Ndv="+text(Ndv);
- println(SCEOUTPUT,tmp+";");
- tmp="#define DsizeLL "+text(DsizeLL);//17.05.21
- println(SCEOUTPUT,tmp);
- tmp="#define DsizeL "+text(DsizeL);
- println(SCEOUTPUT,tmp);
- tmp="#define DsizeM "+text(DsizeM);
- println(SCEOUTPUT,tmp);
- tmp="#define DsizeS "+text(DsizeS);
- println(SCEOUTPUT,tmp);
- tmp="const double Eps="+format(Eps,7);
- tmp=tmp+", Eps1="+format(Eps1,7);
- tmp=tmp+", Eps2="+format(Eps2,7);
- tmp=tmp+", Eps3= "+format(Eps3,7);
- println(SCEOUTPUT,tmp+";");
- tmp="void surffun(double u, double v, double pt[3]){";
- println(SCEOUTPUT,tmp);
- forall(fdc_1,
- tmp1=replace(#,"x=","pt[0]=");
- tmp1=replace(tmp1,"y=","pt[1]=");
- tmp1=replace(tmp1,"z=","pt[2]=");
- println(SCEOUTPUT," "+tmp1+";");
- );
- println(SCEOUTPUT,"}");
- closefile(SCEOUTPUT);
-);
-
-Cmain():=Cmain(FheadC+".c",MainC);
-Cmain(fname,cmdLorg):=(
-//help:MainC(writesfbd("sfbd");)
-//help:MainC(writeax("ax");)
-//help:MainC(writewire("wire" (,2), [10,10]);)
-//help:MainC(writewire("wire", [[0.5,1],[0,1,2]]]);)
-//help:MainC(writecut("sfcut","x+y+2*z-4");)
-//help:MainC(writesc("sl3d1");)
-//help:MainC(skeleton("sk",[objlist],[pltlist] (,width));)
-//help:MainC(writewire ptincrease (=2) are optional);)
- regional(cmdL, tmp,tmp1,tmp2,tmp3,tmp4,nL, nn,kk,jj, num, en,cmd,
- ax1,ax2,ax3,path, var,varh,file,fileh, flg, cutctr);
- path=Dirwork+"/"; //17.05.29from
- path=replace(path,"\","/");
- cmdL=cmdLorg;// 17.05.26from
- nL=select(1..(length(cmdL)),cmdL_#=="writeax");
- cmd=[];
- if(length(nL)>0,tmp3=cmdL_(1..(nL_1-1)),tmp3=[]);
- forall(1..(length(nL)),
- tmp2=cmdL_(nL_#+1);
- if(length(tmp2)==1,tmp2=append(tmp2,"Surf"));
- tmp=tmp2_1; // 17.06.08(5lines)
- if(substring(tmp,length(tmp)-2,length(tmp))!="3d",
- tmp=tmp+"3d";
- );
- tmp1=parse(tmp);
- tmp="axx="+textformat(tmp1_1,5);
- parse(tmp);
- tmp="axy="+textformat(tmp1_2,5);
- parse(tmp);
- tmp="axz="+textformat(tmp1_3,5);
- parse(tmp);
- tmp3=concat(tmp3,[
- "double "+tmp2_1+"[DsizeL][3];",[], //17.06.07(2lines)
- "double axx[3][3], axy[3][3], axz[3][3];",[],
- "spaceline",["axx"],
- "spaceline",["axy"],
- "spaceline",["axz"],
- tmp2_1+"[0][0]=0;",[],
- "appendd3(2,1,2,axx,"+tmp2_1+");",[],
- "appendd3(2,1,2,axy,"+tmp2_1+");",[],
- "appendd3(2,1,2,axz,"+tmp2_1+");",[],
- "writecrv",[tmp2_1,tmp2_2] //17.06.07
- ]);
- cmd=concat(cmd,tmp3);
- if(#<length(nL),
- tmp3=cmdL_((nL_#+2)..(nL_(#+1)-1));
- ,
- tmp3=cmdL_((nL_#+2)..(length(cmdL)));
- cmdL=concat(cmd,tmp3);
- );
- );
- nL=select(1..(length(cmdL)),cmdL_#=="writesc");
- cmd=[];
- if(length(nL)>0,tmp3=cmdL_(1..(nL_1-1)),tmp3=[]);
- forall(1..(length(nL)),
- tmp2=cmdL_(nL_#+1);
- if(length(tmp2)==1,
- tmp2=[tmp2_1,"Surf"];
- );
- tmp3=concat(tmp3,[
- "double "+tmp2_1+"[DsizeL][3];",[], //17.06.07(2lines)
- "double "+tmp2_1+"h[DsizeL][3];",[],
- "spaceline",[tmp2_1],
- "writecrv",[tmp2_1,tmp2_2] //17.06.07
- ]);
- cmd=concat(cmd,tmp3);
- if(#<length(nL),
- tmp3=cmdL_((nL_#+2)..(nL_(#+1)-1));
- ,
- tmp3=cmdL_((nL_#+2)..(length(cmdL)));
- cmdL=concat(cmd,tmp3);
- );
- );
- nL=select(1..(length(cmdL)),cmdL_#=="writesfbd");
- cmd=[];
- if(length(nL)>0,tmp3=cmdL_(1..(nL_1-1)),tmp3=[]);
- forall(1..(length(nL)),
- tmp2=cmdL_(nL_#+1);
- if(length(tmp2)==1,tmp2=append(tmp2,"Surf"));
- var=Dq+tmp2_1+"3d"+Dq;
- varh=Dq+tmp2_1+"h3d"+Dq;
- file=Dq+path+FheadC+tmp2_1+".txt"+Dq;
- fileh=Dq+path+FheadC+tmp2_1+"h.txt"+Dq;
- tmp="Borderhiddendata";
- tmp3=concat(tmp3,[
- "double "+tmp2_1+"[DsizeL][3];",[], //17.06.09(6lines)
- "sfbdparadata",[tmp2_1],
- "output3h",["w",var, varh,file,tmp2_1],
- "dataindexd3",[3,tmp2_1,"din"],
- tmp2_2+"[0][0]=0;",[],
- "appendd3",[2,"din[1][0]","din[1][1]",tmp2_1,tmp2_2]
- ]);
- cmd=concat(cmd,tmp3);
- if(#<length(nL),
- tmp3=cmdL_((nL_#+2)..(nL_(#+1)-1));
- ,
- tmp3=cmdL_((nL_#+2)..(length(cmdL)));
- cmdL=concat(cmd,tmp3);
- );
- );
- nL=select(1..(length(cmdL)),cmdL_#=="writecrv");
- cmd=[];
- if(length(nL)>0,tmp3=cmdL_(1..(nL_1-1)),tmp3=[]);
- forall(1..(length(nL)),
- tmp2=cmdL_(nL_#+1);
- if(length(tmp2)==1,tmp2=append(tmp2,"Surf"));
- var=Dq+tmp2_1+"3d"+Dq;
- varh=Dq+tmp2_1+"h3d"+Dq;
- file=Dq+path+FheadC+tmp2_1+".txt"+Dq;
- tmp3=concat(tmp3,[
- "crvsfparadata",[tmp2_1,tmp2_2,1,"Crvdata"],
- tmp2_1+"[0][0]=0;",[], //17.06.09(3lines)
- "appendd3",[0,1,"length3(Crvdata)","Crvdata",tmp2_1],
- "output3h",["w",var, varh, file,tmp2_1]
- ]);
- cmd=concat(cmd,tmp3);
- if(#<length(nL),
- tmp3=cmdL_((nL_#+2)..(nL_(#+1)-1));
- ,
- tmp3=cmdL_((nL_#+2)..(length(cmdL)));
- cmdL=concat(cmd,tmp3);
- );
- );
- nL=select(1..(length(cmdL)),cmdL_#=="writescrvonsf");
- cmd=[];
- if(length(nL)>0,tmp3=cmdL_(1..(nL_1-1)),tmp3=[]);
- forall(1..(length(nL)),
- tmp2=cmdL_(nL_#+1);
- if(length(tmp2)==1,tmp2=append(tmp2,"Surf"));
- var=Dq+tmp2_1+"3d"+Dq;
- varh=Dq+tmp2_1+"h3d"+Dq; //17.06.09(8lines)
- file=Dq+path+FheadC+tmp2_1+".txt"+Dq;
- tmp3=concat(tmp3,[
- "double "+tmp2_1+"[DsizeL][3];",[],
- " crv3onsfparadata",[tmp2_1,tmp2_2,1,"Crvdata"],
- tmp2_1+"[0][0]=0;",[],
- "appendd3",[0,1,"length3(Crvdata)","Crvdata",tmp2_1],
- "output3h",["w",var,varh, file ,tmp2_1]
- ]);
- cmd=concat(cmd,tmp3);
- if(#<length(nL),
- tmp3=cmdL_((nL_#+2)..(nL_(#+1)-1));
- ,
- tmp3=cmdL_((nL_#+2)..(length(cmdL)));
- cmdL=concat(cmd,tmp3);
- );
- );
- nL=select(1..(length(cmdL)),cmdL_#=="writecut");
- cmd=[];
- if(length(nL)>0,tmp3=cmdL_(1..(nL_1-1)),tmp3=[]);
- cutctr=0;
- forall(1..(length(nL)),
- cutctr=#;
- tmp2=cmdL_(nL_#+1);
- if(length(tmp2)==2,
- tmp2=[tmp2_1,"Surf",tmp2_2];
- );
- var=Dq+tmp2_1+"3d"+Dq;
- varh=Dq+tmp2_1+"h3d"+Dq; //17.06.09(10lines)
- file=Dq+path+FheadC+tmp2_1+".txt"+Dq;
- tmp3=concat(tmp3,[
- "cutfun",[tmp2_3],
- "double "+tmp2_1+"[DsizeL][3];",[],
- "sfcutdata",[text(cutctr),"out"], //17.06.02
- "crv3onsfparadata",["out",tmp2_2,"Crvdata"],
- tmp2_1+"[0][0]=0;",[],
- "appendd3",[0,1,"length3(Crvdata)","Crvdata",tmp2_1],
- "output3h",["w",var, varh, file, tmp2_1]
- ]);
- cmd=concat(cmd,tmp3);
- if(#<length(nL),
- tmp3=cmdL_((nL_#+2)..(nL_(#+1)-1));
- ,
- tmp3=cmdL_((nL_#+2)..(length(cmdL)));
- cmdL=concat(cmd,tmp3);
- );
- );
- nL=select(1..(length(cmdL)),cmdL_#=="writewire");
- cmd=[];
- if(length(nL)>0,tmp3=cmdL_(1..(nL_1-1)),tmp3=[]);
- forall(1..(length(nL)),
- tmp2=cmdL_(nL_#+1);
- if(!isstring(tmp2_2),
- tmp2=[tmp2_1,"Surf",tmp2_2,tmp2_3];
- );
- var=Dq+tmp2_1+"3d"+Dq;
- varh=Dq+tmp2_1+"h3d"+Dq; //17.06.09
- file=Dq+path+FheadC+tmp2_1+".txt"+Dq;
- tmp4=tmp2_(length(tmp2)); num=2;
- if(!islist(tmp4),
- num=tmp4; tmp4=tmp2_(length(tmp2)-1);
- );
- if(!islist(tmp4_1),
- tmp3=concat(tmp3,[
- "double udv[2]={-1,"+text(tmp4_1)+"};",[]
- ]);
- ,
- len=length(tmp4_1);
- tmp="double udv["+text(len+1)+"]={"+text(len)+",";
- forall(tmp4_1,
- tmp=tmp+format(#,5)+",";
- );
- tmp=substring(tmp,0,length(tmp)-1)+"};";
- tmp3=concat(tmp3,[tmp,[]]);
- );
- if(!islist(tmp4_2),
- tmp3=concat(tmp3,[
- "double vdv[2]={-1,"+text(tmp4_2)+"};",[]
- ]);
- ,
- len=length(tmp4_2);
- tmp="double vdv["+text(len+1)+"]={"+text(len)+",";
- forall(tmp4_2,
- tmp=tmp+format(#,5)+",";
- );
- tmp=substring(tmp,0,length(tmp)-1)+"};";
- tmp3=concat(tmp3,[tmp,[]]);
- );
- tmp3=concat(tmp3,[
- "double "+tmp2_1+"[DsizeLL][3];",[], //17.06.09(5lines)
- "wireparadata",["Surf", "udv","vdv", num, "Wiredata"],
- tmp2_1+"[0][0]=0;",[],
- "appendd3",[0,1,"length3(Wiredata)","Wiredata",tmp2_1],
- "output3h",["w",var, varh, file, tmp2_1]
- ]);
- cmd=concat(cmd,tmp3);
- if(#<length(nL),
- tmp3=cmdL_((nL_#+2)..(tmp_(#+1)-1));
- ,
- tmp3=cmdL_((nL_#+2)..(length(cmdL)));
- cmdL=concat(cmd,tmp3);
- );
- );// 17.05.29until
- nL=select(1..(length(cmdL)),cmdL_#=="skeleton");// 17.06.05from
- cmd=[];
- if(length(nL)>0,
- tmp3=cmdL_(1..(nL_1-1));
- tmp3=concat(tmp3,["double sk[DsizeLL][3];",[]]);//17.06.13
- ,
- tmp3=[];
- );
- forall(1..(length(nL)),nn,
- tmp2=cmdL_(nL_nn+1);
- var=Dq+tmp2_1+"3d"+Dq;
- file=Dq+path+FheadC+tmp2_1+".txt"+Dq;
- tmp3=concat(tmp3,[ //17.06.08from
- "data[0][0]=0;",[]
- ]);
- forall(tmp2_2,
- if(substring(#,length(#)-1,length(#))!="h",
- tmp1=#;
- tmp=[0,"din[1][0]","din[1][1]",tmp1,"data"];
- ,
- tmp1=substring(#,0,length(#)-1);
- tmp=[0,"din[2][0]","din[2][1]",tmp1,"data"];
- );
- tmp3=concat(tmp3,[
- "dataindexd3",[3,tmp1,"din"],
- "appendd3",tmp
- ]);
- );
- forall(1..(length(tmp2_3)),
- if(substring(tmp2_3_#,length(tmp2_3_#)-1,length(tmp2_3_#))!="h",
- tmp1=tmp2_3_#;
- tmp=[0,"din[1][0]","din[1][1]",tmp1,"data"];
- ,
- tmp1=substring(tmp2_3_#,0,length(tmp2_3_#)-1);
- tmp=[0,"din[2][0]","din[2][1]",tmp1,"data"];
- );
- tmp3=concat(tmp3,[
- "push3",["Inf",3,0,"data"],
- "dataindexd3",[3,tmp1,"din"],
- "appendd3",tmp
- ]);
- );
- if(length(tmp2)<=3,tmp=1,tmp=tmp2_4);
- tmp3=concat(tmp3,[
- "skeletondata3",["data", tmp, "Eps1","Eps2","sk"],//17.06.13
- "output3",["w",var, file, 2, "sk"]
- ]);
- cmd=concat(cmd,tmp3);
- if(nn<length(nL),
- tmp3=cmdL_((nL_nn+2)..(nL_(nn+1)-1));
- ,
- tmp3=cmdL_((nL_nn+2)..(length(cmdL)));
- cmdL=concat(cmd,tmp3);
- );//17.06.08until
- );// 17.06.05until
- path=DirlibC+"/";
- path=replace(path,"\","/");
- cmd=[
- "#include <stdio.h>", "#include <math.h>",
- "#include "+Dq+FheadC+"header.h"+Dq,
- "#include "+Dq+path+"ketcommon.h"+Dq,
- "#include "+Dq+path+"surflibhead.h"+Dq,
- "#include "+Dq+path+"surflib.h"+Dq,
- "int main(void){",
- " double out[DsizeL][3], data[DsizeLL][3];", //17.06.10
- " int i, j, nall, din[DsizeS][2];" //17.06.09
- ];
-// tmp=select(cmdL,#=="cutfun");
-// if(length(tmp)==0,
- if(cutctr==0, //17.06.02
- cmdL=prepend(["1"],cmdL);
- cmdL=prepend("cutfun",cmdL);
- );// 17.05.26until
- cutctr=0;
- forall(1..(floor(length(cmdL))/2),nn,
- tmp1=cmdL_(2*nn-1); tmp2=cmdL_(2*nn);
- flg=0; // 17.05.26from
- if(tmp1=="cutfun",
- cutctr=cutctr+1;
- tmp=select(1..(length(cmd)), indexof(cmd_#,"main")>0);
- tmp3=cmd_((tmp_1)..(length(cmd)));
- cmd=cmd_(1..(tmp_1-1));
- cmd=append(cmd,"double cutfun"+text(cutctr)+"(double u, double v){");
- cmd=append(cmd," double p[3],val;");
- cmd=append(cmd," surffun(u,v,p);");
- tmp=" val="+assign(tmp2_1,["x","p[0]","y","p[1]","z","p[2]"])+";";
- cmd=concat(cmd, [tmp," return val;", "}"]);
- cmd=concat(cmd, tmp3);
- flg=1;
- );
- if(tmp1=="xyzax3data",
- tmp=" "+tmp1+"(";
- tmp=tmp+textformat(tmp2_1_1_1_1,5)+",";
- tmp=tmp+textformat(tmp2_1_1_2_1,5)+",";
- tmp=tmp+textformat(tmp2_1_2_1_2,5)+",";
- tmp=tmp+textformat(tmp2_1_2_2_2,5)+",";
- tmp=tmp+textformat(tmp2_1_3_1_3,5)+",";
- tmp=tmp+textformat(tmp2_1_3_2_3,5)+",";
- tmp=tmp+tmp2_2+");";
- cmd=append(cmd,tmp);
- flg=1;
- );
- if(tmp1=="spaceline",
- if(!isstring(tmp2_1),
- println(tmp2_1+" should be assgined as a string");
- ,
- tmp3=parse(tmp2_1);
- tmp=text(length(tmp3)+1);
-// cmd=append(cmd, " double "+tmp2_1+"["+tmp+"][3];");
- tmp=text(length(tmp3));
- cmd=append(cmd, " "+tmp2_1+"[0][0]="+tmp+";");
- forall(1..(length(tmp3)),
- tmp=" "+tmp2_1+"["+text(#)+"][0]="+textformat(tmp3_#_1,5)+",";
- tmp=tmp+tmp2_1+"["+text(#)+"][1]="+textformat(tmp3_#_2,5)+",";
- tmp=tmp+tmp2_1+"["+text(#)+"][2]="+textformat(tmp3_#_3,5)+";";
- cmd=append(cmd,tmp);
- );
- );
- flg=1;
- );
- if(flg==0,
- tmp=" "+tmp1;
- if(length(tmp2)>0,
- tmp=tmp+"(";
- forall(1..length(tmp2),kk,
- if(isstring(tmp2_kk),
- if((kk==1)&(substring(tmp1,0,5)=="write"),
- file=path+FheadC+tmp2_kk+".txt";
- fileh=path+FheadC+tmp2_kk+"h.txt";
- tmp=tmp+Dq+tmp2_kk+Dq+","+Dq+file+Dq+","+Dq+fileh+Dq;
- ,
- tmp=tmp+tmp2_kk;
- );
- ,
- if(!islist(tmp2_kk),
- tmp=tmp+textformat(tmp2_kk,5);
- ,
- );
- );
- if(kk<length(tmp2),
- tmp=tmp+",";
- ,
- tmp=tmp+");";
- );
- );
- );
- cmd=append(cmd, tmp);// 17.05.26until
- );
- );
- tmp=select(1..(length(cmd)), indexof(cmd_#,"main")>0);//17.06.02from
- tmp3=cmd_((tmp_1)..(length(cmd)));
- cmd=cmd_(1..(tmp_1-1));
- cmd=append(cmd,"double cutfun(int ch, double u, double v){");
- cmd=append(cmd," double val;");
- forall(1..cutctr,
- tmp=text(#);
- cmd=append(cmd," if(ch=="+tmp+"){val=cutfun"+tmp+"(u,v);}");
- );
- cmd=concat(cmd,[" return val;", "}"]);
- cmd=concat(cmd, tmp3);//17.06.02until
- cmd=concat(cmd, [" return 0;", "}"]);
- SCEOUTPUT = openfile(fname);
- forall(cmd,
- println(SCEOUTPUT,#);
+////%Contsurf start////
+Contsurf():=ContsurfC("");
+Contsurf(restr):=ContsurfC(restr);
+ContsurfC(restr):=(//181101
+//help:Contsurf();
+ regional(cL,tmp,tmp1,tmp2);
+ if(substring(restr,0,1)=="R",
+ GLIST=[];
);
- closefile(SCEOUTPUT);
- tmp=fileslist(Dirwork); // 17.05.20from
- tmp=tokenize(tmp,",");
- tmp=select(tmp,indexof(#,".txt")>0);
- tmp=select(tmp,indexof(#,FheadC)>0);
- forall(tmp,
- SCEOUTPUT = openfile(#);
- println(SCEOUTPUT,"");
- closefile(SCEOUTPUT);
- ); // 17.05.20until
+ cL=CommandListC;
+ cL=cL_(1..(length(cL)-1));
+ CommandListC=cL;
);
+////%Contsurf end////
+////%kcC start////
kcC():=kcC(FheadC);
kcC(cname):=(
regional(tmp, tmp1,flg,rfile);
@@ -5430,7 +5155,11 @@ kcC(cname):=(
tmp=cname+".txt";
println(kc(Dirwork+Batparent,Mackc+Dirlib,tmp));
,
- SCEOUTPUT = openfile("kc.sh");
+ if(ismacosx(), //181125from
+ SCEOUTPUT = openfile("kc.command");
+ ,
+ SCEOUTPUT = openfile("kc.sh");
+ ); //181125to
println(SCEOUTPUT,"#!/bin/sh");
println(SCEOUTPUT,"cd "+Dq+Dirwork+Dq);
tmp=PathC+" -lm "+cname+".c -o main.out"; //180612
@@ -5461,6 +5190,7 @@ kcC(cname):=(
println("kcC succeeded");
);
);
+////%kcC end////
ReaddataCold(var, fname):=ReaddataC(var, fname,[]);
ReaddataC(var, fname,options):=(
@@ -5488,6 +5218,7 @@ ReaddataC(var, fname,options):=(
);//17.06.16until
);
+////%ReaddataC start////
ReaddataC(fnameorg):=(
regional(tmp,tmp1,fname,data,out);
fname=fnameorg;
@@ -5510,7 +5241,9 @@ ReaddataC(fnameorg):=(
if(length(tmp1)>0,out=append(out,tmp1));
out;
);
+////%ReaddataC end////
+////%WritedataC start////
WritedataC(fnameorg,dataorg):=(
//help:WritedataC(filename, 3ddata);
regional(tmp,fname,data,kk,nn,pt);
@@ -5536,6 +5269,7 @@ WritedataC(fnameorg,dataorg):=(
);
closefile(SCEOUTPUT);
);
+////%WritedataC end////
DisplayC():=DisplayC(DispC);
DisplayC(name,options):=DisplayC([name,options]);
@@ -5556,7 +5290,7 @@ DisplayC(dispc):=(
eqL=tmp_5;
opcindy=tmp_(length(tmp));
forall(eqL,
- if(Toupper(substring(#,0,2))=="CO",
+ if(Toupper(substring(#,0,1))=="C",
tmp=indexof(#,"=");
color=substring(#,tmp,length(#));
if(substring(color,0,1)=="[",
@@ -5584,6 +5318,7 @@ DisplayC(dispc):=(
);
);
+////%Cheadsurf start////
Cheadsurf():=(
regional(cmd,jj,divL,sizeL,epsL,nf,var1,var2,tmp,tmp1,tmp2);
divL=ConstantListC_1;
@@ -5672,7 +5407,9 @@ Cheadsurf():=(
cmd=append(cmd,"}");
cmd;
);
+////%Cheadsurf end////
+////%Ctopsurf start////
Ctopsurf(name):=Ctopsurf(name,CutFunList);
Ctopsurf(name,cutfunLorg):=(
regional(cutfunL,path,cmd,tmp,tmp1,tmp2);
@@ -5716,7 +5453,9 @@ Ctopsurf(name,cutfunLorg):=(
]);
cmd;
);
+////%Ctopsurf end////
+////%WritetoC start////
WritetoC(nm,header,main):=(
regional(hfile,mfile,top,body,tmp,tmp1,tmp2);
hfile=Fhead+nm+"header.h";
@@ -5740,7 +5479,9 @@ WritetoC(nm,header,main):=(
println(SCEOUTPUT,"}");
closefile(SCEOUTPUT);
);
+////%WritetoC end////
+////%CalcbyC start////
CalcbyC(name,cmd):=CalcbyC(name,PathC,cmd,[]);
CalcbyC(name,Arg1,Arg2):=(
if(isstring(Arg1),
@@ -5849,8 +5590,11 @@ CalcbyC(name,path,cmd,optionorg):=(
);
);
);//180615to
+ wflg; //181101
);
+////%CalcbyC end////
+////%ExeccmdC start////
ExeccmdC(nm):=ExeccmdC(nm,[],["do"]); //180531
ExeccmdC(nm,options):=ExeccmdC(nm,options,["do"]);
ExeccmdC(nm,optionorg,optionhorg):=(
@@ -5858,7 +5602,7 @@ ExeccmdC(nm,optionorg,optionhorg):=(
//help:ExeccmdC(options1=["dr(/da/do)","m/r","Wait=30"]);
//help:ExeccmdC(options2=["do(/nodisp/da/do)"]);
regional(options,optionsh,name2,name3,waiting,dirbkup,
- eqL,reL,strL,fname,tmp,tmp1,tmp2,flg,wflg,varL);
+ eqL,reL,strL,fname,cL,tmp,tmp1,tmp2,flg,wflg,varL);
fname=Fhead+nm+".txt";
options=optionorg;
optionsh=optionhorg;
@@ -5884,7 +5628,8 @@ ExeccmdC(nm,optionorg,optionhorg):=(
);
forall(eqL,
tmp=Strsplit(#,"=");
- if(Toupper(tmp_1)=="WAIT",
+ tmp1=Toupper(substring(tmp_1,0,1)); //181111
+ if(tmp1=="W",
waiting=parse(tmp_2);
options=remove(options,[#]);
);
@@ -5903,8 +5648,24 @@ ExeccmdC(nm,optionorg,optionhorg):=(
if(wflg==-1,tmp1=append(options,"r"));
tmp1=append(tmp1,"Wait="+text(waiting));
tmp1=append(tmp1,"Disp=n"); //181024
- CommandListC=prepend(" char fnameall[]="+Dqq(fname)+";",CommandListC);
- CommandListC=prepend(" printf("+Dqq("%s\n")+","+Dqq(Fhead)+");",CommandListC); //180608
+ cL=CommandListC; //181101from
+ tmp2=" char fnameall[]="+Dqq(fname)+";";
+ tmp=select(1..(length(cL)),indexof(cL_#,"char fnameall[]=")>0);
+ if(length(tmp)==0,
+ CommandListC=prepend(tmp2,CommandListC);
+ ,
+ tmp=tmp_1;
+ CommandListC_tmp=tmp2;
+ );
+ cL=CommandListC;
+ tmp2=" printf("+Dqq("%s\n")+","+Dqq("Execcmd "+nm)+");";
+ tmp=select(1..(length(cL)),indexof(cL_#,"printf("+Dqq("%s\n")+","+Dq+"Execcmd ")>0);
+ if(length(tmp)==0,
+ CommandListC=prepend(tmp2,CommandListC);
+ ,
+ tmp=tmp_1;
+ CommandListC_tmp=tmp2;
+ ); //181101to
tmp=select(CommandListC,indexof(#,"outputend")>0);
if(length(tmp)==0,
CommandListC=append(CommandListC," outputend(dirfname);");
@@ -5945,19 +5706,37 @@ ExeccmdC(nm,optionorg,optionhorg):=(
);
varL=select(varL,length(parse(#))>0);
if(length(addpath)>0,Changework(dirbkup,["Sub=n"])); //180605
+ if(SUBSCR==1, // 15.02.11
+ forall(varL, //181106from
+ Subgraph(#,"");
+ );
+ ); //181106to
+ tmp=StyleListC; //181107from
+ tmp1=apply(1..(length(tmp)/2),[tmp_(2*#-1),tmp_(2*#)]);
+ forall(tmp1,tmp2,
+ strL=select(varL,indexof(#,tmp2_1)>0); //181114from
+ forall(strL,
+ if((length(parse(#))>0)&(length(tmp2_2))>0,
+ Changestyle3d(#,tmp2_2);
+ );
+ ); //181114to
+ ); //181107to
varL;
);
+////%ExeccmdC end////
+////%Sfbdparadata start////
Sfbdparadata(nm,fd):=SfbdparadataC(nm,fd);
Sfbdparadata(nm,fd,options):=SfbdparadataC(nm,fd,options);
Sfbdparadata(nm,fdorg,optionorg,optionsh):=SfbdparadataC(nm,fdorg,optionorg,optionsh);
-SfbdparadataC(nm,fd):=
- SfbdparadataC(nm,fd,[],["nodisp"]);
+SfbdparadataC(nm,fd):=(
+ SfbdparadataC(nm,fd,[],["do"]);
+);
SfbdparadataC(nm,fd,options):=
- SfbdparadataC(nm,fd,options,["nodisp"]);
-SfbdparadataC(nm,fdorg,optionorg,optionsh):=(
+ SfbdparadataC(nm,fd,options,["do"]);
+SfbdparadataC(nm,fdorg,optionorg,optionshorg):=(
//help:Sfbdparadata("1",Fd);
- regional(funnm,fd,options,name2,name3,name2h,name3h,waiting,
+ regional(funnm,fd,options,optionsh,name2,name3,name2h,name3h,waiting,
eqL,reL,strL,fname,tmp,tmp1,tmp2,flg,wflg,cmdflg);
if(ChNumber==0,ChNumber=Ch);
fd=ConvertFdtoC(fdorg);
@@ -5978,6 +5757,7 @@ SfbdparadataC(nm,fdorg,optionorg,optionsh):=(
name3h="sfbdh3d"+nm;
fname=Fhead+"sfbd"+nm+".txt";
options=optionorg;
+ optionsh=select(optionshorg,length(#)>0); //181107
tmp=Divoptions(options);
eqL=tmp_5;
reL=tmp_6;
@@ -6002,9 +5782,24 @@ SfbdparadataC(nm,fdorg,optionorg,optionsh):=(
options=remove(options,[#]);
);
);
- options=remove(options,eqL);
options=remove(options,reL);
options=select(options,length(#)>0);
+ tmp1=select(options,
+ (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C")); //181114from
+ if(length(tmp1)>0,
+ tmp1=tmp1_1;
+ tmp2=select(optionsh,
+ (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C"));
+ if(length(tmp2)==0,
+ if(length(optionsh)==0,
+ optionsh=["do",tmp1];
+ ,
+ optionsh=append(optionsh,tmp1);
+ );
+ );
+ ); //181114to
+ StyleListC=concat(StyleListC,[name3,options,name3h,optionsh]); //181107
+ options=remove(options,eqL);
cmdL=[
" char fname"+nm+"[]="+Dqq(fname)+";",
" rangeUV("+funnm+");",
@@ -6021,7 +5816,7 @@ SfbdparadataC(nm,fdorg,optionorg,optionsh):=(
if(length(tmp)>0,
tmp=replace(cmdL_6,Dqq("w"),Dqq("a"));cmdL_6=tmp;
); //180601from
- cmdL=remove(cmdL,[cmdL_1,cmdL_(length(cmdL))]);
+ cmdL=cmdL_(2..(length(cmdL)-1)); //181113
CommandListC=concat(CommandListC,cmdL); //180531to
,
if(wflg==1,tmp1=append(options,"m"));
@@ -6060,19 +5855,22 @@ SfbdparadataC(nm,fdorg,optionorg,optionsh):=(
);
);
);
+////%Sfbdparadata end////
+////%Crvsfparadata start////
Crvsfparadata(nm,fk,sfbd,fd):=CrvsfparadataC(nm,fk,sfbd,fd);
Crvsfparadata(nm,fk,sfbd,fd,options):=CrvsfparadataC(nm,fk,sfbd,fd,options);
Crvsfparadata(nm,Fk,sfbdorg,fdorg,optionorg,optionsh):=
CrvsfparadataC(nm,Fk,sfbdorg,fdorg,optionorg,optionsh);
CrvsfparadataC(nm,fk,sfbd,fd):=
- CrvsfparadataC(nm,fk,sfbd,fd,[],["nodisp"]);
+ CrvsfparadataC(nm,fk,sfbd,fd,[],["do"]);
CrvsfparadataC(nm,fk,sfbd,fd,options):=
- CrvsfparadataC(nm,fk,sfbd,fd,options,["nodisp"]);
-CrvsfparadataC(nm,Fk,sfbdorg,fdorg,optionorg,optionsh):=(
+ CrvsfparadataC(nm,fk,sfbd,fd,options,["do"]);
+CrvsfparadataC(nm,Fk,sfbdorg,fdorg,optionorg,optionshorg):=(
//help:Crvsfparadata("1","ax3d","sfbd3d1",Fd);
- regional(funnm,sfbd,fd,options,name2,name3,name2h,name3h,waiting,
- eqL,reL,strL,fname,tmp,tmp1,tmp2,flg,wflg,flg,ii,jj,eps,cmdlfg);
+//help:Crvsfparadata(options=["Use=y(/n)"];
+ regional(funnm,sfbd,fd,options,optionsh,name2,name3,name2h,name3h,waiting,
+ eqL,reL,strL,fname,tmp,tmp1,tmp2,flg,wflg,useflg,cmdlfg,ii,jj,eps);
eps=10^(-5);
sfbd=replace(sfbdorg,"bdy","sfbd");
fd=ConvertFdtoC(fdorg);
@@ -6084,6 +5882,7 @@ CrvsfparadataC(nm,Fk,sfbdorg,fdorg,optionorg,optionsh):=(
name3h="crvsfh3d"+nm;
fname=Fhead+"crvsf"+nm+".txt";
options=optionorg;
+ optionsh=select(optionshorg,length(#)>0); //181107
tmp=Divoptions(options);
eqL=tmp_5;
reL=tmp_6;
@@ -6108,50 +5907,91 @@ CrvsfparadataC(nm,Fk,sfbdorg,fdorg,optionorg,optionsh):=(
options=remove(options,[#]);
);
);
- options=remove(options,eqL);
+ useflg="N"; //181105from
+ forall(eqL,
+ tmp=Strsplit(#,"=");
+ tmp1=Toupper(substring(tmp_1,0,1));
+ if(tmp1=="U",
+ useflg=Toupper(substring(tmp_2,0,1));
+ );
+ ); //181105to
options=remove(options,reL);
options=select(options,length(#)>0);
- tmp2=parse(Fk);
- flg=0;
- tmp=Fhead+Fk+".dat";
- if(!isexists(Dirwork,tmp),flg=1);
- if(flg==0,
- tmp1=ReaddataC(tmp);
- if(length(tmp1)!=length(tmp2),flg=1);
- if(flg==0,
- forall(1..(length(tmp1)),ii,
- if(length(tmp1_ii)!=length(tmp2_ii),flg=1);
- forall(1..(length(tmp1_ii)),jj,
- if(flg==0,
- if(Norm(tmp1_ii_jj-tmp2_ii_jj)>eps,flg=1);
- );
- );
+ tmp1=select(options,
+ (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C")); //181114from
+ if(length(tmp1)>0,
+ tmp1=tmp1_1;
+ tmp2=select(optionsh,
+ (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C"));
+ if(length(tmp2)==0,
+ if(length(optionsh)==0,
+ optionsh=["do",tmp1];
+ ,
+ optionsh=append(optionsh,tmp1);
);
);
- );
- if(flg==1,WritedataC(tmp,Fk));
+ ); //181114to
+ StyleListC=concat(StyleListC,[name3,options,name3h,optionsh]); //181107
+ options=remove(options,eqL);
+ if(useflg=="N",
+// flg=0;
+// tmp=Fhead+Fk+".dat";
+// if(!isexists(Dirwork,tmp),flg=1);
+// if(flg==0,
+// tmp1=ReaddataC(tmp);
+// tmp2=parse(Fk);
+// if(length(tmp1)==length(tmp2),
+// forall(1..(length(tmp1)),ii,
+// if(length(tmp1_ii)!=length(tmp2_ii),flg=1);
+// forall(1..(length(tmp1_ii)),jj,
+// if(flg==0,
+// if(Norm(tmp1_ii_jj-tmp2_ii_jj)>eps,flg=1);
+// );
+// );
+// );
+// );
+// );
+// if(flg==1,
+ if((islist(parse(Fk))),
+ tmp=Fhead+Fk+".dat";
+ WritedataC(tmp,Fk);
+ ,
+ useflg="Y";
+ );
+// );
+ ); //181105to
if(cmdflg==1,
EraseList=append(EraseList,Fk);
,
Changestyle3d(Fk,["nodisp"]);
);
cmdL=[
- " char fname"+nm+"[]="+Dqq(fname)+";",
+ " char fname"+nm+"[]="+Dqq(fname)+";",
" rangeUV("+funnm+");",
- " boundary("+funnm+");",
- " readdataC("+Dqq(Fhead+Fk+".dat")+",data);",
- " readoutdata3("+Dqq(Fhead+replace(sfbd,"3d","")+".txt")+","+Dqq(sfbd)+",sfbd);", //180531
+ " boundary("+funnm+");"
+ ];
+ if(useflg=="N", //181105from
+ cmdL=concat(cmdL,[
+ " readdataC("+Dqq(Fhead+Fk+".dat")+",data);"
+ ]);
+ ,
+ cmdL=concat(cmdL,[
+ " readoutdata3(dirfname,"+Dqq(Fk)+",data);"
+ ]);
+ );
+ cmdL=concat(cmdL,[
+ " readoutdata3("+Dqq(Fhead+replace(sfbd,"3d","")+".txt")+","+Dqq(sfbd)+",sfbd);",
" crvsfparadata("+funnm+",data,sfbd, 0, out);",
" sprintf(dirfname,"+Dqq("%s%s")+",Dirname,fname"+nm+");",
" output3h("+Dqq("w")+","+Dqq("crvsf3d"+nm)+","+Dqq("crvsfh3d"+nm)+",dirfname,out);",
" outputend(dirfname);"
- ];
+ ]); //181105to
if(cmdflg==1,//180531from
println(" ExeccmdC will generate "+ name3+","+name3h);
- cmdL_5=" readoutdata3(fnameall,"+Dqq(sfbd)+",sfbd);";
- cmdL_7=" sprintf(dirfname,"+Dqq("%s%s")+",Dirname,fnameall);"; //180607
+ cmdL_(length(cmdL)-4)=" readoutdata3(fnameall,"+Dqq(sfbd)+",sfbd);"; //181105(2lines)
+ cmdL_(length(cmdL)-2)=" sprintf(dirfname,"+Dqq("%s%s")+",Dirname,fnameall);";
tmp=replace(cmdL_(length(cmdL)-1),Dqq("w"),Dqq("a")); cmdL_(length(cmdL)-1)=tmp;
- cmdL=remove(cmdL,[cmdL_(length(cmdL))]);
+ cmdL=cmdL_(1..(length(cmdL)-1)); //181113
CommandListC=concat(CommandListC,cmdL); //180531to
,
if(wflg==1,tmp1=append(options,"m"));
@@ -6190,18 +6030,20 @@ CrvsfparadataC(nm,Fk,sfbdorg,fdorg,optionorg,optionsh):=(
);
);
);
+////%Crvsfparadata end////
+////%Crv3onsfparadata start////
Crv3onsfparadata(nm,crv3d,sfbd,fd):=Crv3onsfparadataC(nm,crv3d,sfbd,fd);
Crv3onsfparadata(nm,crv3d,sfbd,fd,options):=Crv3onsfparadataC(nm,crv3d,sfbd,fd,options);
Crv3onsfparadata(nm,crv3d,sfbdorg,fdorg,optionorg,optionsh):=
Crv3onsfparadataC(nm,crv3d,sfbdorg,fdorg,optionorg,optionsh);
Crv3onsfparadataC(nm,crv3d,sfbd,fd):=
- Crv3onsfparadataC(nm,crv3d,sfbd,fd,[],["nodisp"]);
+ Crv3onsfparadataC(nm,crv3d,sfbd,fd,[],["do"]);
Crv3onsfparadataC(nm,crv3d,sfbd,fd,options):=
- Crv3onsfparadataC(nm,crv3d,sfbd,fd,options,["nodisp"]);
-Crv3onsfparadataC(nm,crv3d,sfbdorg,fdorg,optionorg,optionsh):=(
+ Crv3onsfparadataC(nm,crv3d,sfbd,fd,options,["do"]);
+Crv3onsfparadataC(nm,crv3d,sfbdorg,fdorg,optionorg,optionshorg):=(
//help:Crv3onsfparadata("1","sc3","sfbd3d1",fd);
- regional(funnm,sfbd,fd,options,name3,name3h,name2,name2h,waiting,
+ regional(funnm,sfbd,fd,options,optionsh,name3,name3h,name2,name2h,waiting,
eqL,reL,strL,fname,tmp,tmp1,tmp2,flg,wflg,flg,ii,jj,eps,cmdflg);
tmp1=replace(crv3d,"3d","2d");
tmp=apply(GCLIST,#_1);
@@ -6225,6 +6067,7 @@ Crv3onsfparadataC(nm,crv3d,sfbdorg,fdorg,optionorg,optionsh):=(
tmp=apply(fdorg,if(isstring(#),Dqq(#),#));
tmp=text(tmp);
options=optionorg;
+ optionsh=select(optionshorg,length(#)>0); //181107
tmp=Divoptions(options);
eqL=tmp_5;
reL=tmp_6;
@@ -6249,9 +6092,24 @@ Crv3onsfparadataC(nm,crv3d,sfbdorg,fdorg,optionorg,optionsh):=(
options=remove(options,[#]);
);
);
- options=remove(options,eqL);
options=remove(options,reL);
options=select(options,length(#)>0);
+ tmp1=select(options,
+ (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C")); //181114from
+ if(length(tmp1)>0,
+ tmp1=tmp1_1;
+ tmp2=select(optionsh,
+ (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C"));
+ if(length(tmp2)==0,
+ if(length(optionsh)==0,
+ optionsh=["do",tmp1];
+ ,
+ optionsh=append(optionsh,tmp1);
+ );
+ );
+ ); //181114to
+ StyleListC=concat(StyleListC,[name3,options,name3h,optionsh]); //181107
+ options=remove(options,eqL);
tmp2=parse(crv3d);
flg=0;
tmp=Fhead+crv3d+".dat";
@@ -6287,7 +6145,8 @@ Crv3onsfparadataC(nm,crv3d,sfbdorg,fdorg,optionorg,optionsh):=(
cmdL_7=" sprintf(dirfname,"+Dqq("%s%s")+",Dirname,fnameall);"; //180607
tmp=replace(cmdL_(length(cmdL)-1),Dqq("w"),Dqq("a")); cmdL_(length(cmdL)-1)=tmp;
cmdL_5=" readoutdata3(fnameall,"+Dqq(sfbd)+",sfbd);";
- cmdL=remove(cmdL,[cmdL_1,cmdL_(length(cmdL))]);
+ cmdL=cmdL_(2..(length(cmdL)-1)); //181113
+// cmdL=remove(cmdL,[cmdL_1,cmdL_(length(cmdL))]);
CommandListC=concat(CommandListC,cmdL); //180531to
,
if(wflg==1,tmp1=append(options,"m"));
@@ -6326,7 +6185,9 @@ Crv3onsfparadataC(nm,crv3d,sfbdorg,fdorg,optionorg,optionsh):=(
);
);
);
+////%Crv3onsfparadata end////
+////%Crv2onsfparadata start////
Crv2onsfparadata(nm,crv2d,sfbd,fd):=Crv2onsfparadataC(nm,crv2d,sfbd,fd);
Crv2onsfparadata(nm,crv2d,sfbd,fd,options):=Crv2onsfparadataC(nm,crv2d,sfbd,fd,options);
Crv2onsfparadata(nm,crv2d,sfbd,fdorg,options,optionsh):=
@@ -6357,18 +6218,20 @@ Crv2onsfparadataC(nm,crv2d,sfbd,fdorg,options,optionsh):=(
parse(tmp);
Crv3onsfparadataC(nm,crv3d,sfbd,fdorg,options,optionsh);
);
+////%Crv2onsfparadata end////
+////%Wireparadata start////
Wireparadata(nm,sfbd,fd,wr1,wr2):=WireparadataC(nm,sfbd,fd,wr1,wr2);
Wireparadata(nm,sfbd,fd,wr1,wr2,options):=WireparadataC(nm,sfbd,fd,wr1,wr2,options);
Wireparadata(nm,sfbd,fdorg,wr1,wr2,optionorg,optionsh):=
WireparadataC(nm,sfbd,fdorg,wr1,wr2,optionorg,optionsh);
WireparadataC(nm,sfbd,fd,wr1,wr2):=
- WireparadataC(nm,sfbd,fd,wr1,wr2,[],["nodisp"]);
+ WireparadataC(nm,sfbd,fd,wr1,wr2,[],["do"]);
WireparadataC(nm,sfbd,fd,wr1,wr2,options):=
- WireparadataC(nm,sfbd,fd,wr1,wr2,options,["nodisp"]);
-WireparadataC(nm,sfbd,fdorg,wr1,wr2,optionorg,optionsh):=(
+ WireparadataC(nm,sfbd,fd,wr1,wr2,options,["do"]);
+WireparadataC(nm,sfbd,fdorg,wr1,wr2,optionorg,optionshorg):=(
//help:Wireparadata("1","sfbd3d1",fd,5,5);
- regional(funnm,fd,options,name2,name3,name2h,name3h,waiting,
+ regional(funnm,fd,options,optionsh,name2,name3,name2h,name3h,waiting,
eqL,reL,strL,fname,fnameh,tmp,tmp1,tmp2,flg,wflg,flg,ii,jj,eps,udata,vdata,cmdflg);
eps=10^(-5);
fd=ConvertFdtoC(fdorg);
@@ -6381,6 +6244,7 @@ WireparadataC(nm,sfbd,fdorg,wr1,wr2,optionorg,optionsh):=(
fname=Fhead+"wire"+nm+".txt";
fnameh=replace(fname,".txt","h.txt");
options=optionorg;
+ optionsh=select(optionshorg,length(#)>0); //181107
tmp=Divoptions(options);
eqL=tmp_5;
reL=tmp_6;
@@ -6407,9 +6271,24 @@ WireparadataC(nm,sfbd,fdorg,wr1,wr2,optionorg,optionsh):=(
options=remove(options,[#]);
);
);
- options=remove(options,eqL);
options=remove(options,reL);
options=select(options,length(#)>0);
+ tmp1=select(options,
+ (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C")); //181114from
+ if(length(tmp1)>0,
+ tmp1=tmp1_1;
+ tmp2=select(optionsh,
+ (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C"));
+ if(length(tmp2)==0,
+ if(length(optionsh)==0,
+ optionsh=["do",tmp1];
+ ,
+ optionsh=append(optionsh,tmp1);
+ );
+ );
+ ); //181114to
+ StyleListC=concat(StyleListC,[name3,options,name3h,optionsh]); //181107
+ options=remove(options,eqL);
if(islist(wr1),
udata=prepend(length(wr1),wr1);
,
@@ -6454,7 +6333,9 @@ WireparadataC(nm,sfbd,fdorg,wr1,wr2,optionorg,optionsh):=(
tmp=replace(tmp,"fname","fnameall"); cmdL_8=tmp;
cmdL_7=" readoutdata3(fnameall,"+Dqq(sfbd)+",sfbd);";
cmdL=append(cmdL," outputend(dirfname);");
- cmdL=remove(cmdL,[cmdL_3,cmdL_4]); //180827
+ tmp=remove(1..(length(cmdL)),[3,4]); //181113(2lines)
+ cmdL=cmdL_tmp;
+// cmdL=remove(cmdL,[cmdL_3,cmdL_4]); //180827
CommandListC=concat(CommandListC,cmdL); //180531to
,
if(wflg==1,tmp1=append(options,"m"));
@@ -6495,7 +6376,9 @@ WireparadataC(nm,sfbd,fdorg,wr1,wr2,optionorg,optionsh):=(
);
);
);
+////%Wireparadata end////
+////%Intersectcrvsf start////
Intersectcrvsf(nm,crv,fd):=IntersectcrvsfC(nm,crv,fd);
Intersectcrvsf(nm,crv,fd,Arg):=IntersectcrvsfC(nm,crv,fd,Arg);
Intersectcrvsf(nm,crv3d,fdorg,bdyeq,optionorg):=
@@ -6577,8 +6460,10 @@ IntersectcrvsfC(nm,crv3d,fdorg,bdyeq,optionorg):=(
];
if(cmdflg==1,//180531from
cmdL_6=" intersectcrvsf("+Dqq("a")+","+funnm+",crv3d,fnameall);";
- cmdL=remove(cmdL,[cmdL_2]);
- cmdL=remove(cmdL,[cmdL_(length(cmdL))]);
+ tmp=remove(1..(length(cmdL)),[2,length(cmdL)]); //181113(2lines)
+ cmdL=cmdL_tmp;
+// cmdL=remove(cmdL,[cmdL_2]);
+// cmdL=remove(cmdL,[cmdL_(length(cmdL))]);
CommandListC=concat(CommandListC,cmdL); //180531to
,
if(wflg==1,tmp1=append(options,"m"));
@@ -6596,20 +6481,72 @@ IntersectcrvsfC(nm,crv3d,fdorg,bdyeq,optionorg):=(
parse(name);
);
);
+////%Intersectcrvsf end////
+////%Sfcutparadatacdy start//// 181112
+Sfcutparadatacdy(nm,cutfun,fd):=
+ Sfcutparadatacdy(nm,cutfun,fd,[]);
+Sfcutparadatacdy(nm,cutfun,fd,options):=(
+//help:Sfcutparadatacdy("1","2*x+3*y+z=1","sfbd3d",fd,options);
+ regional(out3,out2,name3,name2,eps,fdL,rep,jj,pL,vn1,vn2,
+ tmp,tmp1,tmp2);
+ eps=10^(-5);
+ name2="sfcc2d"+nm;
+ name3="sfcc3d"+nm;
+ fdL=Fullformfunc(fd);
+ tmp=Strsplit(fdL_5,"=");
+ vn1=tmp_1;
+ tmp=Strsplit(fdL_6,"=");
+ vn2=tmp_1;
+ rep=["x",fdL_2,"y",fdL_3,"z",fdL_4];
+ tmp=Assign(cutfun,rep);
+ Implicitplot("sfc"+nm,tmp,fd_5,fd_6,["Msg=n","nodisp"]);
+ out3=[]; out2=[];
+ tmp1=parse("impsfc"+nm);
+ if(MeasureDepth(tmp1)==1,tmp1=[tmp1]);
+ forall(1..(length(tmp1)),jj,
+ pL=tmp1_jj;
+ tmp2=[];
+ forall(pL,
+ tmp=Assign("[x,y,z]",rep);
+ tmp=Assign(tmp,[vn1,#_1,vn2,#_2]);
+ tmp=parse(tmp);
+ tmp2=append(tmp2,tmp);
+ );
+ Spaceline("-sfc"+nm+"n"+text(jj),tmp2,append(options,"Msg=n"));
+ out3=append(out3,tmp2);
+ tmp=Projcurve(tmp2);
+ out2=append(out2,tmp);
+ );
+ tmp=name3+"=["; tmp1=name3+"=[";
+ forall(1..(length(out3)),
+ tmp=tmp+"sfc"+nm+"n"+text(#)+"3d"+",";
+ tmp1=tmp1+Dqq("sfc"+nm+"n"+text(#)+"3d")+",";
+ );
+ tmp=substring(tmp,0,length(tmp)-1)+"]";
+ parse(tmp);
+ tmp1=substring(tmp1,0,length(tmp1)-1)+"]";
+ println("generate sfcutparadata "+tmp1);
+ tmp=name2+"="+Textformat(out2,6);
+ parse(tmp);
+ out3;
+);
+////%Sfcutparadatacdy end////
+
+////%Sfcutparadata start////
Sfcutparadata(nm,cutfunL,sfbd,fd):=SfcutparadataC(nm,cutfunL,sfbd,fd);
Sfcutparadata(nm,cutfunL,sfbd,fd,options):=SfcutparadataC(nm,cutfunL,sfbd,fd,options);
Sfcutparadata(nm,cutfunLorg,sfbd,fdorg,optionorg,optionsh):=
SfcutparadataC(nm,cutfunLorg,sfbd,fdorg,optionorg,optionsh);
SfcutparadataC(nm,cutfunL,sfbd,fd):=(//180505
- SfcutparadataC(nm,cutfunL,sfbd,fd,[],["nodisp"]);
+ SfcutparadataC(nm,cutfunL,sfbd,fd,[],["do"]);
);
SfcutparadataC(nm,cutfunL,sfbd,fd,options):=
SfcutparadataC(nm,cutfunL,sfbd,fd,options,["nodisp"]);
-SfcutparadataC(nm,cutfunLorg,sfbd,fdorg,optionorg,optionsh):=(
+SfcutparadataC(nm,cutfunLorg,sfbd,fdorg,optionorg,optionshorg):=(
//help:Sfcutparadata("1","2*x+3*y+z=1","sfbd3d",fd);
- regional(funnm,cutfunL,fd,options,name2,name3,name2h,name3h,waiting,
- eqL,reL,strL,fname,fnameh,tmp,tmp1,tmp2,flg,wflg,flg,ii,jj,eps,cmdflg);
+ regional(funnm,cutfunL,fd,options,optionsh,name2,name3,name2h,name3h,
+ waiting,eqL,reL,strL,fname,fnameh,tmp,tmp1,tmp2,flg,wflg,flg,ii,jj,eps,cmdflg);
eps=10^(-5);
fd=ConvertFdtoC(fdorg);
tmp=select(1..(length(FuncListC)),FuncListC_#==fd);
@@ -6631,6 +6568,7 @@ SfcutparadataC(nm,cutfunLorg,sfbd,fdorg,optionorg,optionsh):=(
fname=Fhead+"sfcut"+nm+".txt";
fnameh=replace(fname,".txt","h.txt");
options=optionorg;
+ optionsh=select(optionshorg,length(#)>0); //181107
tmp=Divoptions(options);
eqL=tmp_5;
reL=tmp_6;
@@ -6657,9 +6595,24 @@ SfcutparadataC(nm,cutfunLorg,sfbd,fdorg,optionorg,optionsh):=(
options=remove(options,[#]);
);
);
- options=remove(options,eqL);
options=remove(options,reL);
options=select(options,length(#)>0);
+ tmp1=select(options,
+ (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C")); //181114from
+ if(length(tmp1)>0,
+ tmp1=tmp1_1;
+ tmp2=select(optionsh,
+ (indexof(#,"=")>0)&(Toupper(substring(#,0,1))=="C"));
+ if(length(tmp2)==0,
+ if(length(optionsh)==0,
+ optionsh=["do",tmp1];
+ ,
+ optionsh=append(optionsh,tmp1);
+ );
+ );
+ ); //181114to
+ StyleListC=concat(StyleListC,[name3,options,name3h,optionsh]); //181107
+ options=remove(options,eqL);
tmp1=text(length(cutfunL));
cmdL=[
" char fname[]="+Dqq(fname)+";",
@@ -6675,7 +6628,8 @@ SfcutparadataC(nm,cutfunLorg,sfbd,fdorg,optionorg,optionsh):=(
tmp=replace(tmp,"fname","fnameall"); cmdL_6=tmp;
cmdL_5=" readoutdata3(fnameall,"+Dqq(sfbd)+",sfbd);";
cmdL=append(cmdL," outputend(dirfname);");
- cmdL=remove(cmdL,[cmdL_1,cmdL_2]); //180827
+ cmdL=cmdL_(3..(length(cmdL))); //181113
+// cmdL=remove(cmdL,[cmdL_1,cmdL_2]); //180827
CommandListC=concat(CommandListC,cmdL); //180531to
,
if(wflg==1,tmp1=append(options,"m"));
@@ -6716,6 +6670,7 @@ SfcutparadataC(nm,cutfunLorg,sfbd,fdorg,optionorg,optionsh):=(
);
);
);
+////%Sfcutparadata end////
//help:end();