⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 equation_systems.h

📁 一个用来实现偏微分方程中网格的计算库
💻 H
📖 第 1 页 / 共 2 页
字号:
  /**   * @returns a reference to the mesh_data   */  MeshData & get_mesh_data();  /**   * @serializes a distributed mesh and its associated   * degree of freedom numbering for all systems   **/  void allgather ();  /**   * Data structure holding arbitrary parameters.   */  Parameters parameters;  protected:    /**   * The mesh data structure   */  MeshBase& _mesh;  /**   * A pointer to the MeshData object you would like to use.   * Can be NULL.   */  MeshData* _mesh_data;  /**   * Data structure holding the systems.   */  std::map<std::string, System*> _systems;  /**   * Typedef for system iterators   */  typedef std::map<std::string, System*>::iterator       system_iterator;  /**   * Typedef for constatnt system iterators   */  typedef std::map<std::string, System*>::const_iterator const_system_iterator;private:  /**   * This function is used in the implementation of add_system,   * it loops over the nodes and elements of the Mesh, adding the   * system to each one.  The main reason to separate this part   * is to avoid coupling this header file to mesh.h, and elem.h.   */  void _add_system_to_nodes_and_elems();};// ------------------------------------------------------------// EquationSystems inline methodsinlineconst MeshBase & EquationSystems::get_mesh () const{  return _mesh;}inlineMeshBase & EquationSystems::get_mesh (){  return _mesh;}inlineconst MeshData & EquationSystems::get_mesh_data () const{  libmesh_assert (_mesh_data != NULL);  return *_mesh_data;}inlineMeshData & EquationSystems::get_mesh_data (){  libmesh_assert (_mesh_data != NULL);  return *_mesh_data;}inlinebool EquationSystems::has_mesh_data () const {  return (_mesh_data!=NULL);}inlineunsigned int EquationSystems::n_systems () const{  return _systems.size();}template <typename T_sys>inlineT_sys & EquationSystems::add_system (const std::string& name){  T_sys* ptr = NULL;    if (!_systems.count(name))    {      ptr = new T_sys(*this, name, this->n_systems());      _systems.insert (std::make_pair(name, ptr));         // Tell all the \p DofObject entities to add a system.      this->_add_system_to_nodes_and_elems();    }  else    {      // We now allow redundant add_system calls, to make it      // easier to load data from files for user-derived system      // subclasses//      std::cerr << "ERROR: There was already a system"//		<< " named " << name//		<< std::endl;//      libmesh_error();      ptr = &(this->get_system<T_sys>(name));    }  // Return a dynamically casted reference to the newly added System.  return *ptr;}inlinebool EquationSystems::has_system (const std::string& name) const{  if (_systems.find(name) == _systems.end())    return false;  return true;}template <typename T_sys>inlineconst T_sys & EquationSystems::get_system (const unsigned int num) const{  libmesh_assert (num < this->n_systems());  const_system_iterator       pos = _systems.begin();  const const_system_iterator end = _systems.end();  for (; pos != end; ++pos)    if (pos->second->number() == num)      break;  // Check for errors  if (pos == end)    {      std::cerr << "ERROR: no system number " << num << " found!"		<< std::endl;      libmesh_error();    }  // Attempt dynamic cast  T_sys* ptr = dynamic_cast<T_sys*>(pos->second);  // Check for failure of dynamic cast  if (ptr == NULL)    {      std::cerr << "ERROR: cannot convert system "		<< num << " to requested type!"		<< std::endl;      libmesh_error();    }    return *ptr;}template <typename T_sys>inlineT_sys & EquationSystems::get_system (const unsigned int num){  libmesh_assert (num < this->n_systems());    const_system_iterator       pos = _systems.begin();  const const_system_iterator end = _systems.end();  for (; pos != end; ++pos)    if (pos->second->number() == num)      break;  // Check for errors  if (pos == end)    {      std::cerr << "ERROR: no system number " << num << " found!"		<< std::endl;      libmesh_error();    }  // Attempt dynamic cast  T_sys* ptr = dynamic_cast<T_sys*>(pos->second);  // Check for failure of dynamic cast  if (ptr == NULL)    {      std::cerr << "ERROR: cannot convert system "		<< num << " to requested type!"		<< std::endl;      libmesh_error();    }  return *ptr; }template <typename T_sys>inlineconst T_sys & EquationSystems::get_system (const std::string& name) const{  const_system_iterator pos = _systems.find(name);  // Check for errors  if (pos == _systems.end())    {      std::cerr << "ERROR: no system named \"" << name << "\" found!"		<< std::endl;      libmesh_error();    }  // Attempt dynamic cast  T_sys* ptr = dynamic_cast<T_sys*>(pos->second);  // Check for failure of dynamic cast  if (ptr == NULL)    {      std::cerr << "ERROR: cannot convert system \""		<< name << "\" to requested type!"		<< std::endl;      libmesh_error();    }  return *ptr; }template <typename T_sys>inlineT_sys & EquationSystems::get_system (const std::string& name){  system_iterator pos = _systems.find(name);  // Check for errors  if (pos == _systems.end())    {      std::cerr << "ERROR: no system named " << name << " found!"		<< std::endl;      libmesh_error();    }  // Attempt dynamic cast  T_sys* ptr = dynamic_cast<T_sys*>(pos->second);  // Check for failure of dynamic cast  if (ptr == NULL)    {      std::cerr << "ERROR: cannot convert system \""		<< name << "\" to requested type!"		<< std::endl;      libmesh_error();    }  return *ptr; }inlineconst System & EquationSystems::get_system (const std::string& name) const{  return this->get_system<System>(name);}inlineSystem & EquationSystems::get_system (const std::string& name){  return this->get_system<System>(name);}inlineconst System & EquationSystems::get_system (const unsigned int num) const{  return this->get_system<System>(num);}inlineSystem & EquationSystems::get_system (const unsigned int num){  return this->get_system<System>(num);}#endif

⌨️ 快捷键说明

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