Initialize structure.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(silo_obj), | intent(inout) | :: | this |
A silo object |
||
| character(len=*), | intent(in) | :: | filename |
File to read/write |
||
| character(len=*), | intent(in) | :: | access_flag |
File access mode |
||
| type(parallel_obj), | intent(in), | target | :: | parallel |
Parallel structure to link with |
|
| integer, | intent(in), | optional | :: | nproc_node |
Number of procs per silo |
impure subroutine silo_obj_Init(this,filename,access_flag,parallel,nproc_node) !> Initialize structure. implicit none class(silo_obj), intent(inout) :: this !! A silo object character(len=*), intent(in) :: filename !! File to read/write character(len=*), intent(in) :: access_flag !! File access mode type(parallel_obj), intent(in), & target :: parallel !! Parallel structure to link with integer, intent(in), & optional :: nproc_node !! Number of procs per silo ! Work variables type(sysutils_obj) :: sysutils integer :: ierr logical :: file_exists type(stringtool_obj) :: stringtool ! Point to the master objects this%parallel => parallel ! Set the file name (remove any extension) this%filename = stringtool%RemoveExtension(filename) ! Collective IO Init ! -------------------------- ! ! If present, set number of procs per SILO or else ! use default value this%nproc_node=SILOchannels if (present(nproc_node)) this%nproc_node=nproc_node call this%CreateGroups() ! Set the access flag this%access_flag=trim(adjustl(access_flag)) ! Create Silo folder if (this%parallel%RankIsRoot()) & call sysutils%CreateDirectory(SILOdir) ! Create Visit file write(this%visitname,fmt='(4a)') SILOdir,'/',trim(adjustl(this%filename)),VISIT_EXTENSION if (this%parallel%RankIsRoot()) then inquire (file=this%visitname, exist=file_exists) if (.not.file_exists) then ! Create file open(newunit=this%fid_VisIt,file=trim(adjustl(this%visitname)),action='write',status='new',iostat=ierr) if (ierr.ne.0) call this%parallel%Stop('Unable to create VisIt file') else ! Open existing file open(newunit=this%fid_VisIt,file=trim(adjustl(this%visitname)),action='readwrite',access='sequential',form='formatted',status='old',iostat=ierr) if (ierr.ne.0) call this%parallel%Stop('Unable to create VisIt file') end if end if ! Allow Empty Silo Objects ierr = dbsetemptyok(1) return end subroutine silo_obj_Init