boundary.cpp

来自「不错的国外的有限元程序代码,附带详细的manual,可以节省很多的底层工作.」· C++ 代码 · 共 44 行

CPP
44
字号
//   file BOUNDARY.CXX
 
#include "boundary.hxx"
#include "timestep.hxx"
#include "loadtime.hxx"


double  BoundaryCondition :: give (char u, TimeStep* stepN)
   // Returns the value at stepN of the prescribed value of the kinematic 
   // unknown 'u'. Returns 0 if 'u' has no prescribed value.
{
   double value,factor ;
 
   if (! prescribedValueDictionary)
      this -> readConditions() ;

   if (prescribedValueDictionary -> includes(u)) {
      value  = prescribedValueDictionary -> at(u) ;
      factor = this -> giveLoadTimeFunction() -> at(stepN->giveTime()) ;
      return value*factor ;}
   else
      return 0. ;
}


void  BoundaryCondition :: readConditions ()
   // Sets up the dictionary where the receiver stores the conditions it
   // imposes.
{
   char   key [32] ; // 'key' is eventually of size 1, but some words that are
   double value ;    // read in the meantime in the data file can be larger !
   int    nCond,i,j ;

   prescribedValueDictionary = new Dictionary() ;
   i     = 0 ;
   nCond = this->readInteger("conditions",++i) ;

   for (j=1 ; j<=nCond ; j++) {
      this -> readString("conditions",++i,key) ;
      value = this->read("conditions",++i) ;
      prescribedValueDictionary -> add(key[0],value) ;}
}

⌨️ 快捷键说明

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