10 #include "netcdfcpp.h"
19 : _meshList( meshes ), _fname( fname ), _ncFile(NULL), _xVals(NULL), _yVals(NULL), _zVals(NULL),
20 _gatherIndicesVals(NULL), _scatterIndicesVals(NULL), MAX_CHAR(40), BOUN_TYPE_DIM(false), NEIGH_MESH( false ), INTERFACE( false )
77 assert(
_ncFile->add_att(
"nmesh",
"number of total meshes") );
79 int index_interface = 0;
84 int nfaceCells_col = 0;
85 int nfaceNodes_col = 0;
89 for (
int id = 0;
id <
_nmesh->size();
id++ ){
90 index_boun +=
_meshList.at(
id)->getBoundaryGroupCount();
91 index_interface +=
_meshList.at(
id)->getInterfaceGroupCount();
92 nnodes +=
_meshList.at(
id)->getNodes().getCount();
93 nfaces +=
_meshList.at(
id)->getFaces().getCount();
94 ncells +=
_meshList.at(
id)->getCells().getCount();
95 nface_row +=
_meshList.at(
id)->getAllFaceCells().getRow().getLength();
96 nfaceCells_col +=
_meshList.at(
id)->getAllFaceCells().getCol().getLength();
97 nfaceNodes_col +=
_meshList.at(
id)->getAllFaceNodes().getCol().getLength();
101 StorageSite::ScatterMap::const_iterator it;
102 for ( it = scatterMap.begin(); it != scatterMap.end(); it++ )
103 ninterface += it->second->getLength();
108 if ( index_boun > 0 ){
111 assert(
_ncFile->add_att(
"boun_type_dim",
"total count of boundary types") );
116 assert(
_ncFile->add_att(
"char_dim",
"maximum capacity of char variable" ) );
118 if ( index_interface > 0 ){
121 assert(
_ncFile->add_att(
"nNeighMesh",
"count of neighbour meshes") );
127 assert(
_ncFile->add_att(
"nnodes",
"number of nodes" ) );
128 assert(
_ncFile->add_att(
"nfaces",
"number of faces" ) );
129 assert(
_ncFile->add_att(
"ncells",
"number of cells" ) );
135 assert(
_ncFile->add_att(
"nface_row",
"row dimension of face connectivity" ) );
136 assert(
_ncFile->add_att(
"nfaceCells_col",
"col dimension of faceCells connectivity" ) );
137 assert(
_ncFile->add_att(
"nfaceNodes_col",
"col dimension of faceNodes connectivity" ) );
139 if ( ninterface > 0 ){
142 assert(
_ncFile->add_att(
"nInterface",
"total interfaces") );
243 for (
long id = 0;
id <
_nmesh->size();
id++ ){
254 _meshList.at(
id)->getCells().getSelfCount() );
291 for (
int boun = 0; boun < int(bounFaceList.size()); boun++ ) {
298 assert(
int(bounFaceList.at(boun)->groupType.size()) <
MAX_CHAR );
313 for (
int interface = 0;
interface < int( interfaceList.size() ); interface++ ){
329 for (
int n = 0; n < nn; n++ ){
384 StorageSite::ScatterMap::const_iterator it_scatterMap;
385 Mesh::GhostCellSiteMap::const_iterator it_siteScatter;
389 for ( it_siteScatter = ghostCellSiteScatterMap.begin(); it_siteScatter != ghostCellSiteScatterMap.end(); it_siteScatter++ ){
390 const StorageSite* site = it_siteScatter->second.get();
391 it_scatterMap = cellScatterMap.find( site );
392 int nend = it_scatterMap->second->getLength();
394 for (
int n = 0; n < nend; n++ ){
402 StorageSite::GatherMap ::const_iterator it_gatherMap;
403 Mesh::GhostCellSiteMap::const_iterator it_siteGather;
405 for ( it_siteGather = ghostCellSiteGatherMap.begin(); it_siteGather != ghostCellSiteGatherMap.end(); it_siteGather++ ){
406 const StorageSite* site = it_siteGather->second.get();
407 it_gatherMap = cellGatherMap.find( site );
408 int nend = it_gatherMap->second->getLength();
410 for (
int n = 0; n < nend; n++ ){
424 for (
int id = 0;
id < mesh_end;
id++ ){
427 StorageSite::ScatterMap::const_iterator it;
428 for ( it = scatterMap.begin(); it != scatterMap.end(); it++ )
429 ninterface += it->second->getLength();
441 assert(
_dimension->add_att(
"dim",
"dimension of meshes, 1:1D, 2:2D, 3:3D." ) );
442 assert(
_meshID->add_att(
"id",
" mesh identificaton index" ) );
443 assert(
_facesCount->add_att(
"StorageSite",
"number of faces") );
444 assert(
_cellsCount->add_att(
"StorageSite",
"number of cells ") );
445 assert(
_ghostCellsCount->add_att(
"StorageSite",
"number of ghost cells") );
446 assert(
_nodesCount->add_att(
"StorageSite",
"number of nodes") );
447 assert(
_mapCount->add_att(
"neigh_count",
"total neighboorhood mesh counts") );
450 assert(
_boundaryGroup->add_att(
"boundary_group",
" total boundary faces") );
452 assert(
_boundarySize->add_att(
"boundary_size",
" size of boundary" ) );
453 assert(
_boundaryOffset->add_att(
"boundary_offset",
" offset of boundary" ) );
454 assert(
_boundaryID->add_att(
"boundary_id",
" boundary id " ) );
455 assert(
_boundaryType->add_att(
"boundary_type",
" type of boundary condition ") );
458 assert(
_interfaceGroup->add_att(
"interface_group",
" total interfaces") );
461 assert(
_interfaceSize->add_att(
"interface_size",
" size of interface" ) );
462 assert(
_interfaceOffset->add_att(
"interface_offset",
" offset of interface" ) );
463 assert(
_interfaceID->add_att(
"interface_id",
" interface id " ) );
466 assert(
_x->add_att(
"x",
"x-coordinate") );
467 assert(
_y->add_att(
"y",
"y-coordinate") );
468 assert(
_z->add_att(
"z",
"z-coordinate") );
470 assert(
_faceCellsRowCount->add_att(
"face_cells_row_count",
"count of row values of faceCells CRconnctivities") );
471 assert(
_faceNodesRowCount->add_att(
"face_nodes_row_count",
"count of row values of faceNodes CRconnctivities") );
472 assert(
_faceCellsColCount->add_att(
"face_cells_col_count",
"count of col values of faceCells CRconnctivities") );
473 assert(
_faceNodesColCount->add_att(
"face_nodes_col_count",
"count of col values of faceNodes CRconnctivities") );
475 assert(
_faceCellsRow->add_att(
"face_cells_row",
"row values of faceCells CRconnctivities") );
476 assert(
_faceNodesRow->add_att(
"face_nodes_row",
"row values of faceNodes CRconnctivities") );
477 assert(
_faceCellsCol->add_att(
"face_cells_col",
"col values of faceCells CRconnctivities") );
478 assert(
_faceNodesCol->add_att(
"face_nodes_col",
"col values of faceNodes CRconnctivities") );
480 assert(
_gatherIndices->add_att(
"from_indices",
"trom indices from other neightbour mesh " ) );
481 assert(
_scatterIndices->add_att(
"to_indices",
"to indices in current mesh") );
vector< int > _facesCountVals
const CRConnectivity & getAllFaceNodes() const
const Array< int > & getCol() const
int * _scatterIndicesVals
const Array< int > & getRow() const
vector< int > _boundarySizeVals
vector< int > _meshIDVals
NcVar * _faceNodesColCount
vector< int > _faceNodesColCountVals
vector< int > _faceCellsRowCountVals
NcVar * _neighMeshBoolVar
vector< int > _interiorFaceGroupVals
NcVar * _faceCellsColCount
vector< int > _boundaryIDVals
void connectivities(int id)
int mappers_index(int mesh_end)
NcVar * _interiorFaceGroup
vector< int > _faceCellsColCountVals
const CRConnectivity & getAllFaceCells() const
vector< int > _mapCountVals
vector< int > _interfaceOffsetVals
vector< int > _boundaryGroupVals
const Array< VecD3 > & getNodeCoordinates() const
virtual void * getData() const
vector< FaceGroupPtr > FaceGroupList
map< PartIDMeshIDPair, shared_ptr< StorageSite > > GhostCellSiteMap
vector< const char * > _boundaryTypeVals
vector< int > _ghostCellsCountVals
map< const StorageSite *, shared_ptr< Array< int > > > ScatterMap
void get_boundary_vals(int id)
vector< int > _interfaceGroupVals
NcVar * _faceNodesRowCount
vector< int > _boundaryOffsetVals
NcVar * _interfaceBoolVar
vector< int > _faceNodesRowCountVals
vector< int > _nodesCountVals
NcDataWriter(const MeshList &meshes, const string &fname)
map< const StorageSite *, shared_ptr< Array< int > > > GatherMap
vector< int > _dimensionVals
NcVar * _faceCellsRowCount
vector< int > _interfaceSizeVals
vector< int > _interfaceIDVals
void get_interface_vals(int id)
vector< int > _cellsCountVals
vector< Mesh * > MeshList