LCOV - code coverage report
Current view: top level - src/io - WriteTemplate.hpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 0 6 0.0 %
Date: 2020-12-16 07:07:30 Functions: 0 10 0.0 %
Branches: 0 8 0.0 %

           Branch data     Line data    Source code
       1                 :            : /**
       2                 :            :  * MOAB, a Mesh-Oriented datABase, is a software component for creating,
       3                 :            :  * storing and accessing finite element mesh data.
       4                 :            :  *
       5                 :            :  * Copyright 2004 Sandia Corporation.  Under the terms of Contract
       6                 :            :  * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
       7                 :            :  * retains certain rights in this software.
       8                 :            :  *
       9                 :            :  * This library is free software; you can redistribute it and/or
      10                 :            :  * modify it under the terms of the GNU Lesser General Public
      11                 :            :  * License as published by the Free Software Foundation; either
      12                 :            :  * version 2.1 of the License, or (at your option) any later version.
      13                 :            :  *
      14                 :            :  */
      15                 :            : 
      16                 :            : //-------------------------------------------------------------------------
      17                 :            : // Filename      : WriteTemplate.hpp
      18                 :            : //
      19                 :            : // Purpose       : ExodusII writer
      20                 :            : //
      21                 :            : // Special Notes : Lots of code taken from verde implementation
      22                 :            : //
      23                 :            : // Creator       : Corey Ernst
      24                 :            : //
      25                 :            : // Date          : 8/02
      26                 :            : //
      27                 :            : // Owner         : Corey Ernst
      28                 :            : //-------------------------------------------------------------------------
      29                 :            : 
      30                 :            : #ifndef WRITETemplate_HPP
      31                 :            : #define WRITETemplate_HPP
      32                 :            : 
      33                 :            : #ifndef IS_BUILDING_MB
      34                 :            : #error "WriteTemplate.hpp isn't supposed to be included into an application"
      35                 :            : #endif
      36                 :            : 
      37                 :            : #include <vector>
      38                 :            : #include <string>
      39                 :            : 
      40                 :            : #include "moab/Forward.hpp"
      41                 :            : #include "moab/Range.hpp"
      42                 :            : #include "moab/ExoIIInterface.hpp"
      43                 :            : #include "moab/WriterIface.hpp"
      44                 :            : 
      45                 :            : namespace moab
      46                 :            : {
      47                 :            : 
      48                 :            : class WriteUtilIface;
      49                 :            : 
      50                 :            : class WriteTemplate : public WriterIface
      51                 :            : {
      52                 :            : 
      53                 :            :   public:
      54                 :            :     //! Constructor
      55                 :            :     WriteTemplate( Interface* impl );
      56                 :            : 
      57                 :            :     //! Destructor
      58                 :            :     virtual ~WriteTemplate();
      59                 :            : 
      60                 :            :     static WriterIface* factory( Interface* );
      61                 :            : 
      62                 :            :     //! writes out a file
      63                 :            :     ErrorCode write_file( const char* file_name, const bool overwrite, const FileOptions& opts,
      64                 :            :                           const EntityHandle* output_list, const int num_sets,
      65                 :            :                           const std::vector< std::string >& qa_list, const Tag* tag_list = NULL, int num_tags = 0,
      66                 :            :                           int export_dimension = 3 );
      67                 :            : 
      68                 :            :     //! struct used to hold data for each block to be output; used by
      69                 :            :     //! initialize_file to initialize the file header for increased speed
      70                 :            :     struct MaterialSetData
      71                 :            :     {
      72                 :            :         int id;
      73                 :            :         int number_elements;
      74                 :            :         int number_nodes_per_element;
      75                 :            :         int number_attributes;
      76                 :            :         ExoIIElementType element_type;
      77                 :            :         EntityType moab_type;
      78                 :            :         Range* elements;
      79                 :            :     };
      80                 :            : 
      81                 :            :     //! struct used to hold data for each nodeset to be output; used by
      82                 :            :     //! initialize_file to initialize the file header for increased speed
      83 [ #  # ][ #  # ]:          0 :     struct DirichletSetData
      84                 :            :     {
      85                 :            :         int id;
      86                 :            :         int number_nodes;
      87                 :            :         std::vector< EntityHandle > nodes;
      88                 :            :         std::vector< double > node_dist_factors;
      89                 :            :     };
      90                 :            : 
      91                 :            :     //! struct used to hold data for each sideset to be output; used by
      92                 :            :     //! initialize_file to initialize the file header for increased speed
      93 [ #  # ][ #  # ]:          0 :     struct NeumannSetData
      94                 :            :     {
      95                 :            :         int id;
      96                 :            :         int number_elements;
      97                 :            :         std::vector< EntityHandle > elements;
      98                 :            :         std::vector< int > side_numbers;
      99                 :            :         EntityHandle mesh_set_handle;
     100                 :            :     };
     101                 :            : 
     102                 :            :   protected:
     103                 :            :     //! number of dimensions in this file
     104                 :            :     // int number_dimensions();
     105                 :            : 
     106                 :            :     //! open a file for writing
     107                 :            :     ErrorCode open_file( const char* filename );
     108                 :            : 
     109                 :            :     //! contains the general information about a mesh
     110                 :          0 :     class MeshInfo
     111                 :            :     {
     112                 :            :       public:
     113                 :            :         unsigned int num_dim;
     114                 :            :         unsigned int num_nodes;
     115                 :            :         unsigned int num_elements;
     116                 :            :         unsigned int num_matsets;
     117                 :            :         unsigned int num_dirsets;
     118                 :            :         unsigned int num_neusets;
     119                 :            :         Range nodes;
     120                 :            : 
     121                 :          0 :         MeshInfo()
     122                 :          0 :             : num_dim( 0 ), num_nodes( 0 ), num_elements( 0 ), num_matsets( 0 ), num_dirsets( 0 ), num_neusets( 0 )
     123                 :            :         {
     124                 :          0 :         }
     125                 :            :     };
     126                 :            : 
     127                 :            :   private:
     128                 :            :     //! interface instance
     129                 :            :     Interface* mbImpl;
     130                 :            :     WriteUtilIface* mWriteIface;
     131                 :            : 
     132                 :            :     //! file name
     133                 :            :     std::string fileName;
     134                 :            : 
     135                 :            :     //! Cached tags for reading.  Note that all these tags are defined when the
     136                 :            :     //! core is initialized.
     137                 :            :     Tag mMaterialSetTag;
     138                 :            :     Tag mDirichletSetTag;
     139                 :            :     Tag mNeumannSetTag;
     140                 :            :     Tag mGlobalIdTag;
     141                 :            : 
     142                 :            :     Tag mEntityMark;  // used to say whether an entity will be exported
     143                 :            : 
     144                 :            :     ErrorCode gather_mesh_information( MeshInfo& mesh_info, std::vector< MaterialSetData >& matset_info,
     145                 :            :                                        std::vector< NeumannSetData >& neuset_info,
     146                 :            :                                        std::vector< DirichletSetData >& dirset_info,
     147                 :            :                                        std::vector< EntityHandle >& matsets, std::vector< EntityHandle >& neusets,
     148                 :            :                                        std::vector< EntityHandle >& dirsets );
     149                 :            : 
     150                 :            :     ErrorCode initialize_file( MeshInfo& mesh_info );
     151                 :            : 
     152                 :            :     ErrorCode write_nodes( const int num_nodes, const Range& nodes, const int dimension );
     153                 :            : 
     154                 :            :     ErrorCode write_matsets( MeshInfo& mesh_info, std::vector< MaterialSetData >& matset_data,
     155                 :            :                              std::vector< NeumannSetData >& neuset_data );
     156                 :            : 
     157                 :            :     ErrorCode get_valid_sides( Range& elems, const int sense, WriteTemplate::NeumannSetData& neuset_data );
     158                 :            : 
     159                 :            :     void reset_matset( std::vector< MaterialSetData >& matset_info );
     160                 :            : 
     161                 :            :     ErrorCode get_neuset_elems( EntityHandle neuset, int current_sense, Range& forward_elems, Range& reverse_elems );
     162                 :            : };
     163                 :            : 
     164                 :            : }  // namespace moab
     165                 :            : 
     166                 :            : #endif

Generated by: LCOV version 1.11