material.cpp

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

CPP
62
字号
//   file MATERIAL.CXX
 
#include "material.hxx"
#include "domain.hxx"
#include "verbose.def"
#include <stdlib.h>


double  Material :: give (char aProperty)
   // Returns the value of the property aProperty (e.g. the Young's modulus
   // 'E') of the receiver.
{
   double  value ;
 
   if (propertyDictionary -> includes(aProperty))
      value = propertyDictionary -> at(aProperty) ;
   else {                                         // read and store the value
      value = this -> read(aProperty) ;
      propertyDictionary -> add(aProperty,value) ;}
   return value ;
}


void  Material :: instanciateYourself ()
{
   double value ;

#  ifdef VERBOSE
      printf ("\ninstanciating material %d\n",number) ;
#  endif

   if (this->readWhetherHas("E")) {
      value = this -> read("E") ;
      propertyDictionary -> add('E',value) ;}

   if (this->readWhetherHas("n")) {
      value = this -> read("n") ;
      propertyDictionary -> add('n',value) ;}

   if (this->readWhetherHas("d")) {
      value = this -> read("d") ;
      propertyDictionary -> add('d',value) ;}

   if (this->readWhetherHas("A")) {
      value = this -> read("A") ;
      propertyDictionary -> add('A',value) ;}

   if (this->readWhetherHas("t")) {
      value = this -> read("t") ;
      propertyDictionary -> add('t',value) ;}
}


void  Material :: printYourself ()
   // Prints the receiver on screen.
{
   printf ("Material with properties : \n") ;
   propertyDictionary -> printYourself() ;
}


⌨️ 快捷键说明

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