Beispiel #1
0
 explicit path(const rstd::string &s) {
   string_input_stream s_in(s);
   text_input_stream<string_input_stream> t_in(s_in);
   t_in.read_all(m_directories, ':');
   rstd::vector<rstd::string>::iterator ii = m_directories.begin();
   while (ii != m_directories.end()) {
     *ii = str::trim(*ii);
     if (ii->length() <= 0) {
       m_directories.erase(ii);
     } else {
       ++ii;
     }
   }
 }
  void SolidMechanicsBCHandling::init_bc_types( const BoundaryID bc_id,
                                                const std::string& bc_id_string,
                                                const int bc_type,
                                                const std::string& bc_vars,
                                                const std::string& bc_value,
                                                const GetPot& input )
  {
    switch(bc_type)
      {
      case(PINNED):
        {
          this->set_dirichlet_bc_type( bc_id, bc_type );
        }
        break;

      case(CONSTANT_DISPLACEMENT):
        {
          this->set_dirichlet_bc_type( bc_id, bc_type );

          int n_disp_comps = input.vector_variable_size("Physics/"+_physics_name+"/displacement_"+bc_id_string);

          if( _disp_vars.have_v() )
            {
              if( n_disp_comps < 2 )
                {
                  std::cerr << "Error: Must specify at least 2 displacement components for 2-D problem." << std::endl;
                  libmesh_error();
                }
            }

          if( _disp_vars.have_w() )
            {
              if( n_disp_comps < 3 )
                {
                  std::cerr << "Error: Must specify 3 displacement components for 3-D problem." << std::endl;
                  libmesh_error();
                }
            }

          for( int i = 0; i < n_disp_comps; i++ )
            {
              this->set_dirichlet_bc_value( bc_id,
                                            input("Physics/"+_physics_name+"/displacement_"+bc_id_string, 0.0, i ),
                                            i );
            }
        }
        break;

      case(ROLLER_X):
      case(ROLLER_Y):
      case(ROLLER_Z):
      case(SYMMETRY_YZ):
      case(SYMMETRY_XZ):
      case(SYMMETRY_XY):
        {
          this->set_dirichlet_bc_type( bc_id, bc_type );
        }
        break;

      case(CONSTANT_TRACTION):
        {
          this->set_neumann_bc_type( bc_id, bc_type );

          libMesh::Gradient t_in;

          int num_t_components = input.vector_variable_size("Physics/"+_physics_name+"/traction_"+bc_id_string);

          if( num_t_components < 3 )
            {
              std::cerr << "Error: Expecting 3 components when specifying traction!" << std::endl
                        << "       Found " << num_t_components << " components." << std::endl;
              libmesh_error();
            }

          for( int i = 0; i < num_t_components; i++ )
            {
              t_in(i) = input("Physics/"+_physics_name+"/traction_"+bc_id_string, 0.0, i );
            }

          this->set_neumann_bc_value( bc_id, t_in );
        }
        break;

      default:
        {
          // Call base class to detect any physics-common boundary conditions
          BCHandlingBase::init_bc_types( bc_id, bc_id_string, bc_type,
                                         bc_vars, bc_value, input );
        }

      }// End switch(bc_type)

    return;
  }