// Write vector data data into a HDF5 file. PetscErrorCode ProbeVolume::writeVecHDF5(const Vec &vec, const PetscReal &t) { PetscErrorCode ierr; PetscFunctionBeginUser; std::string field_str = type::fd2str[field]; ierr = PetscViewerHDF5PushGroup(viewer, field_str.c_str()); CHKERRQ(ierr); ierr = PetscObjectSetName((PetscObject) vec, std::to_string(t).c_str()); CHKERRQ(ierr); ierr = VecView(vec, viewer); CHKERRQ(ierr); if (count != 0) // add number of time-steps accumulated as attribute { ierr = PetscViewerHDF5WriteAttribute( viewer, ("/" + field_str + "/" + std::to_string(t)).c_str(), "count", PETSC_INT, &count); CHKERRQ(ierr); } PetscFunctionReturn(0); } // ProbeVolume::writeVecHDF5
PETSC_EXTERN void PETSC_STDCALL petscviewerhdf5writeattribute_(PetscViewer viewer, char parent[], char name[],PetscDataType *datatype, void*value, int *__ierr ){ *__ierr = PetscViewerHDF5WriteAttribute( (PetscViewer)PetscToPointer((viewer) ),parent,name,*datatype,value); }