use.pl

来自「有限元学习研究用源代码(老外的),供科研人员参考」· PL 代码 · 共 73 行

PL
73
字号
#! /usr/local/bin/perl
$base = $ARGV[0];
$opt = $ARGV[1];
$ind = $ARGV[2];
if($ENV{"COG_HOME"}){
    $cog = $ENV{"COG_HOME"};
}else{
    $cog = $ENV{"PDELIB_HOME"}.'/modules/cog';
}
if($ENV{"COG_WORK"}){
    $w  = $ENV{"COG_WORK"}."/";
}else{
    $w  = "./";
}
 
if(!$base){
    print "
usage: use [cog|ref|gen|seg|out] [option]

cog: defines the cogeometry 
ref: defines the refinement criteria
gen: defines the grid generator version
box: defines the coarse grid (domain of grid generation)
seg: defines the segment description (region colors)
out: defines the output

without [option] you get a list of the available options.
See tutorial.html for more information.

";

    exit;
}
if(!$opt){
    $cmd = "ls ".$w.$base."\*test.html ".$cog.'/'.$base."\*test.html 2\>\/dev\/null";
#    $cmd = "ls ".$cog.'/'.$base."\*test.html";
    $list = `$cmd`; 
    $list=~s/$cog\///g;
    $list=~s/$w//g;
    $def = $base."test.html\n"; $list=~s/$def//g;
    $list=~s/$base/ \| /g;  
    $list=~s/test.html\n//g;
    $list=~s/ \| //;
    print "
usage: use ".$base." \[ ".$list." \]

for an option xxx, see ".$base."xxxtest.html for more information.

";
}

$target = $w.$base.$ind."test.cxx";

$source = $w.$base.$opt."test.html";
if(! -e $source){$source = $cog.'/'.$base.$opt."test.html";} 
if(-e $source){
    $cmd = "html2cxx ".$source." ".$target;
    `$cmd`;
    print "using now C++ code from file ".$source." as ".$target."\n";
}else{
    $source = $base.$opt."test.cxx";
    if(! -e $source){$source = $cog.'/'.$source;}
    if(-e $source){
	$cmd = "cp -f ".$source." ".$target;
	`$cmd`;
	print "using now file ".$source." as ".$target."\n";
    }else{
	print "source for file $target not found\n";
    }
}
 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?