Commits

Gautam Bisht committed 05ca785

Added Glenn's suggested stringswapchar subroutine to remove whitespace in output variable name for VTK format

  • Participants
  • Parent commits 0343161

Comments (0)

Files changed (2)

File src/pflotran/output_vtk.F90

   use Option_module
   use Field_module
   use Patch_module
+  use String_module
   
   use Reaction_Aux_module
   use Variables_module
                                 cur_variable%isubvar)
     call DiscretizationGlobalToNatural(discretization,global_vec, &
                                         natural_vec,ONEDOF)
+    word=trim(cur_variable%name)
+    call StringSwapChar(word," ","_")
     if (cur_variable%iformat == 0) then
       call WriteVTKDataSetFromVec(OUTPUT_UNIT,realization_base, &
-        cur_variable%name,natural_vec,VTK_REAL)
+        word,natural_vec,VTK_REAL)
     else
       call WriteVTKDataSetFromVec(OUTPUT_UNIT,realization_base, &
-        cur_variable%name,natural_vec,VTK_INTEGER)
+        word,natural_vec,VTK_INTEGER)
     endif
     cur_variable => cur_variable%next
   enddo

File src/pflotran/string.F90

             StringStartsWith, &
             StringAdjustl, &
             StringNull, &
-            StringFindEntryInList
+            StringFindEntryInList, &
+            StringSwapChar
   
   interface StringCompare
     module procedure StringCompare1
   
 end function StringFindEntryInList
 
+! ************************************************************************** !
+!
+! StringSwapChar: Swaps a character from a string
+!
+! author: Glenn Hammond
+! date: 02/04/13
+!
+! ************************************************************************** !
+subroutine StringSwapChar(string,char_in,char_out)
+ 
+  implicit none
+ 
+  character(len=*) :: string
+  character(len=1) :: char_in
+  character(len=1) :: char_out
+ 
+  PetscInt :: i
+ 
+  do i=1, len_trim(string)
+   if (string(i:i) == char_in(1:1)) string(i:i) = char_out(1:1)
+  enddo
+ 
+end subroutine StringSwapChar
+
 end module String_module