您好,欢迎访问三七文档
当前位置:首页 > IT计算机/网络 > 数据库 > flac3d手册中的fish说明(新手必看)
FLAC3DVersion2.06-16FISHREFERENCE6.1IntroductionandOverviewChapter6containsadetailedreferencetotheFISHlanguage.Followingtheintroduction,Sec-tion6.2describestherulesofthelanguageandhowvariablesandfunctionsareused.Section6.3explainsFISHstatementsandSection6.4describeshowtheFISHlanguagelinkswithFLAC3D.Pre-definedFISHvariables,functionsandarraysaredescribedinSection6.5.Section6.6discussesextensionstoFISH,theuseofwhichgenerallyrequiresareasonableunderstandingofprogrammingtechniquesandconstructs,althoughFISHcanbeusedwithoutreferencetotheseextensions.FISHisaprogramminglanguageembeddedwithinFLAC3Dthatenablestheusertodefinenewvariablesandfunctions.ThesefunctionsmaybeusedtoextendFLAC3D’susefulnessoradduser-definedfeatures.Forexample,newvariablesmaybeplottedorprinted,specialgridgeneratorsmaybeimplemented,servo-controlmaybeappliedtoanumericaltest,unusualdistributionsofpropertiesmaybespecified,andparameterstudiesmaybeautomated.FISHisa“compiler”(ratherthanan“interpreter”):programsenteredviaaFLAC3DdatafilearetranslatedintoalistofinstructionsstoredinFLAC3D’smemoryspace;theoriginalsourceprogramisnotretainedbyFLAC3D.WheneveraFISHfunctionisinvoked,itscompiledcodeisexecuted.Theuseofcompiledcode—ratherthaninterpretedsourcecode—enablesprogramstorunmuchfaster.However,unlikeacompiler,variablenamesandvaluesareavailableforprintingatanytime;valuesmaybemodifiedbytheuserbyusingFLAC3D’sSETcommand.FISHprogramsaresimplyembeddedinanormalFLAC3Ddatafile—linesfollowingthewordDEFINEareprocessedasaFISHfunction;thefunctionterminateswhenthewordENDisencoun-tered.Functionsmayinvokeotherfunctions,whichmayinvokeothers,andsoon.Theorderinwhichfunctionsaredefineddoesnotmatteraslongastheyarealldefinedbeforetheyareused(e.g.,invokedbyaFLAC3Dcommand).SincethecompiledformofaFISHfunctionisstoredinFLAC3D’smemoryspace,theSAVEcommandsavesthefunctionandthecurrentvaluesofassociatedvariables.AsummaryofFISHlanguageandintrinsicnamesisprovidedinAppendixA.6-2FLAC3DVersion2.06.2FISHLanguageRules,VariablesandFunctions6.2.1LinesFISHprogramscanbeembeddedinanormalFLAC3Ddatafileormaybeentereddirectlyfromthekeyboard—linesfollowingthewordDEFINEaretakentobestatementsofaFISHfunction;thefunctionterminateswhenthewordENDisencountered.AvalidlineofFISHcodemusttakeoneofthefollowingforms.1.Thelinestartswithastatement,suchasIF,LOOP,etc.(seeSection6.3).2.Thelinecontainsoneormorenamesofuser-definedFISHfunctions,separatedbyspaces—e.g.,fun1fun2fun3wherethenamescorrespondtofunctionswrittenbytheuser;thesefunctionsareexecutedinorder.ThefunctionsneednotbedefinedpriortotheirreferenceonalineofFISHcode(i.e.,forwardreferencesareallowed).3.Thelineconsistsofanassignmentstatement(i.e.,theexpressionontherightofthe=signisevaluatedandthevaluegiventothevariableorfunctionnametotheleftofthe=sign).4.ThelineconsistsofaFLAC3Dcommand,providedthatthelineisembeddedinasectionofFISHcodedelimitedbytheCOMMAND–ENDCOMMANDstatements(seeSection6.3.3).5.Thelineisblankorstartswithasemicolon.FISHvariables,functionnamesandstatementsmustbespelledoutinfull;theycannotbetruncated,asinFLAC3Dcommands.Nocontinuationlinesareallowed:intermediatevariablesmaybeusedtosplitcomplexexpressions.FISHis“case-insensitive”bydefault—i.e.,itmakesnodistinctionbetweenupper-caseandlower-caseletters;allnamesareconvertedtolower-caseletters.(NotethatthiscanbechangedwiththecommandSETcaseon.)Spacesaresignificant(unlikeinFORTRAN)andservetoseparatevariables,keywords,andsoon;noembeddedblanksareallowedinvariableorfunctionnames.Extraspacesmaybeusedtoimprovereadability—forexample,byindentingloopsandconditionalclauses.Anycharactersfollowingasemi-colon(;)areignored;commentsmaybeembeddedinaFISHprogrambyprecedingthemwithasemi-colon.BlanklinesmaybeembeddedinaFISHprogram.FLAC3DVersion2.06-36.2.2ReservedNamesforFunctionsandVariablesVariableorfunctionnamesmuststartwithanon-numberandmustnotcontainanyofthefollowingsymbols(bewaryofpunctuationorsymbolsingeneral):.,*/+-ˆ=#()[]@;’User-definednamescanbeanylength,buttheyaretruncatedinprint-outandinplotcaptionsduetoline-lengthlimitations.Ingeneral,namesmaybechosenarbitrarily,althoughtheymustnotbethesameasaFISHstatement(seeSection6.3)orapre-definedvariableorfunction(seeSection6.5).TherearealsomanyotherwordsusedinFLAC3Dinputthatshouldbeavoided.ThelistcontainedinTable6.2showsallwordsthatcouldgiverisetoaconflictifusedtonameaFISHvariableorfunction.However,thepotentialconflictdependsonthewayinwhichthechosennameisused.Forexample,thewordgravitycouldbeusedasaFISHvariableprovidedthatitissimplyreferredtoinsideaFISHfunction;aconflictwouldariseonlyifitisnecessarytousetheSETcommandtosetitsvalue,sincegravityisavalidargumenttotheSETcommand.Similarly,itmaybeimpossibletoprintthevalueofaFISHvariableifitsnameisthesameasaparameterforthePRINTcommand.Ifindoubt,avoidanyofthenameslistedinTable6.2orcontractionsofthenames(sinceFLAC3Dallowstruncationofkeywordsandcommands).Asanalternativestrategy,theFLAC3DcommandSETsafeoncanbeusedtoforcetheexplicitrecognitionofFISHvariablesinacommandlineinstruction.The@symbolpre-pendedtoanyFISHvariableidentifestheobjectassuchandforcesthe
本文标题:flac3d手册中的fish说明(新手必看)
链接地址:https://www.777doc.com/doc-3477873 .html