open Subroutine

private subroutine open(self, file_name, format, action, access)

Open file.

Arguments

Type IntentOptional AttributesName
class(file_object), intent(inout) :: self

File object.

character(len=*), intent(in), optional :: file_name

File name.

character(len=*), intent(in), optional :: format

File format.

character(len=*), intent(in), optional :: action

File action.

character(len=*), intent(in), optional :: access

File access.


Source Code


Source Code

   subroutine open(self, file_name, format, action, access)
   !< Open file.
   class(file_object), intent(inout)        :: self       !< File object.
   character(len=*),   intent(in), optional :: file_name  !< File name.
   character(len=*),   intent(in), optional :: format     !< File format.
   character(len=*),   intent(in), optional :: action     !< File action.
   character(len=*),   intent(in), optional :: access     !< File access.
   character(len=:), allocatable            :: file_name_ !< File name, local variable.
   character(len=:), allocatable            :: format_    !< File format, local variable.
   character(len=:), allocatable            :: action_    !< File action, local variable.
   character(len=:), allocatable            :: access_    !< File access, local variable.

   format_ = 'unformatted' ; if (present(format)) format_ = format
   action_ = 'readwrite'   ; if (present(action)) action_ = action
   access_ = 'stream'      ; if (present(access)) access_ = access

   if (self%is_initialized) then
      file_name_ = self%file_name ; if (present(file_name)) file_name_ = trim(adjustl(file_name))
      if (.not.self%is_connected) then
         open(newunit=self%file_unit, file=file_name_, form=format_, action=action_, access=access_)
         self%is_connected = .true.
      else
         write(stderr, '(A)') 'error: file "'//self%file_name//'" is already connected, thus its unit cannot be re-open'
         self%error%status = ERROR_ALREADY_CONNECTED
      endif
   else
      write(stderr, '(A)') 'error: file is not initialized, thus it cannot be open'
      self%error%status = ERROR_NOT_INITIALIZED
   endif
   endsubroutine open


adim_assign_adim allocate_blocks block_assign_block block_d_assign_block_d cell_assign_cell cells_number cells_number check cli_parse cli_parse cli_parse close compute_extents compute_faces_metrics compute_metrics compute_metrics compute_reference_values compute_space_operator compute_volumes correct_metrics cp create_linspace description description description description description description description description description destroy destroy destroy destroy destroy destroy destroy destroy destroy destroy destroy destroy destroy destroy destroy err_assign_err face_assign_face file_assign_file free_assign_free grid_d_assign_grid_d initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize initialize_unix initialize_windows integrate interpolate_at_nodes iolength iolength iopos_block_nodes is_the_end load_file_grid load_file_name_from_file load_file_parameters load_from_file load_from_file load_from_file load_from_file load_from_file load_from_file load_from_file load_grid_dimensions_from_file load_input_files load_nodes_from_file load_nodes_from_file mkdir node_assign_node node_to_center nodes_number nodes_number nullify_normals open os_assign_os parse_command_line_interface progress rm save_file_grid save_file_grid save_file_grid_tec save_file_grid_vtk save_file_name_into_file save_file_parameters save_grid_dimensions_into_file save_into_file save_into_file save_into_file save_into_file save_into_file save_into_file save_into_file save_nodes_into_file save_nodes_into_file set_command_line_interface set_stop solver_assign_solver time_assign_time update