1 |
+ |
!! |
2 |
+ |
!! Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
+ |
!! |
4 |
+ |
!! The University of Notre Dame grants you ("Licensee") a |
5 |
+ |
!! non-exclusive, royalty free, license to use, modify and |
6 |
+ |
!! redistribute this software in source and binary code form, provided |
7 |
+ |
!! that the following conditions are met: |
8 |
+ |
!! |
9 |
+ |
!! 1. Acknowledgement of the program authors must be made in any |
10 |
+ |
!! publication of scientific results based in part on use of the |
11 |
+ |
!! program. An acceptable form of acknowledgement is citation of |
12 |
+ |
!! the article in which the program was described (Matthew |
13 |
+ |
!! A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
14 |
+ |
!! J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
15 |
+ |
!! Parallel Simulation Engine for Molecular Dynamics," |
16 |
+ |
!! J. Comput. Chem. 26, pp. 252-271 (2005)) |
17 |
+ |
!! |
18 |
+ |
!! 2. Redistributions of source code must retain the above copyright |
19 |
+ |
!! notice, this list of conditions and the following disclaimer. |
20 |
+ |
!! |
21 |
+ |
!! 3. Redistributions in binary form must reproduce the above copyright |
22 |
+ |
!! notice, this list of conditions and the following disclaimer in the |
23 |
+ |
!! documentation and/or other materials provided with the |
24 |
+ |
!! distribution. |
25 |
+ |
!! |
26 |
+ |
!! This software is provided "AS IS," without a warranty of any |
27 |
+ |
!! kind. All express or implied conditions, representations and |
28 |
+ |
!! warranties, including any implied warranty of merchantability, |
29 |
+ |
!! fitness for a particular purpose or non-infringement, are hereby |
30 |
+ |
!! excluded. The University of Notre Dame and its licensors shall not |
31 |
+ |
!! be liable for any damages suffered by licensee as a result of |
32 |
+ |
!! using, modifying or distributing the software or its |
33 |
+ |
!! derivatives. In no event will the University of Notre Dame or its |
34 |
+ |
!! licensors be liable for any lost revenue, profit or data, or for |
35 |
+ |
!! direct, indirect, special, consequential, incidental or punitive |
36 |
+ |
!! damages, however caused and regardless of the theory of liability, |
37 |
+ |
!! arising out of the use of or inability to use software, even if the |
38 |
+ |
!! University of Notre Dame has been advised of the possibility of |
39 |
+ |
!! such damages. |
40 |
+ |
!! |
41 |
+ |
|
42 |
|
! vector_class.F90 |
43 |
|
!! Module Vector_class |
44 |
|
!! Fortran 95 Vector class module. Similar to java.util vector class. |
60 |
|
!! @author J. Daniel Gezelter |
61 |
|
!! @author Charles F. Vardeman II |
62 |
|
!! @author Matthew Meineke |
63 |
< |
!! @version $Id: vector_class.F90,v 1.1.1.1 2004-09-24 04:16:37 gezelter Exp $, $Date: 2004-09-24 04:16:37 $, $Name: not supported by cvs2svn $, $Revision: 1.1.1.1 $ |
63 |
> |
!! @version $Id: vector_class.F90,v 1.6 2005-04-12 21:28:07 gezelter Exp $, $Date: 2005-04-12 21:28:07 $, $Name: not supported by cvs2svn $, $Revision: 1.6 $ |
64 |
|
|
65 |
|
module Vector_class |
66 |
|
|
68 |
|
PRIVATE |
69 |
|
|
70 |
|
public :: initialize |
71 |
+ |
public :: destroy |
72 |
|
public :: getSize |
73 |
|
public :: getElementAt |
74 |
|
public :: getPropertyListSize |
78 |
|
public :: getElementProperty |
79 |
|
public :: getMatchingElementList |
80 |
|
public :: getFirstMatchingElement |
81 |
+ |
|
82 |
|
|
83 |
|
integer, parameter :: logical_data_type = 1 |
84 |
|
integer, parameter :: integer_data_type = 2 |
667 |
|
that => initialize(newCapacity, newPropCap, & |
668 |
|
this%capacityIncrement, this%PropertyIncrement) |
669 |
|
call copyAllData(this, that) |
670 |
< |
deallocate(this) |
670 |
> |
this => destroy(this) |
671 |
|
this => that |
672 |
|
endif |
673 |
|
end subroutine ensureCapacityHelper |
826 |
|
end function initialize_3i |
827 |
|
|
828 |
|
function initialize_4i(cap, nprop, capinc, propinc) result(this) |
829 |
< |
integer, intent(in) :: cap, nprop, capinc, propinc |
829 |
> |
integer, intent(in) :: cap, nprop, capinc, propinc |
830 |
|
integer :: error |
831 |
|
type(Vector), pointer :: this |
832 |
|
|
877 |
|
if(error .ne. 0) write(*,*) 'Could not allocate logicalElementProperties!' |
878 |
|
|
879 |
|
end function initialize_4i |
880 |
+ |
|
881 |
+ |
!! This function destroys the vector components.... |
882 |
+ |
function destroy(this) result(null_this) |
883 |
+ |
logical :: done |
884 |
+ |
type(Vector), pointer :: this |
885 |
+ |
type(Vector), pointer :: null_this |
886 |
+ |
|
887 |
+ |
if (.not. associated(this)) then |
888 |
+ |
null_this => null() |
889 |
+ |
return |
890 |
+ |
end if |
891 |
|
|
892 |
+ |
!! Walk down the list and deallocate each of the vector component |
893 |
+ |
if(associated(this%logicalElementProperties)) then |
894 |
+ |
deallocate(this%logicalElementProperties) |
895 |
+ |
this%logicalElementProperties=>null() |
896 |
+ |
endif |
897 |
+ |
if(associated(this%realElementProperties)) then |
898 |
+ |
deallocate(this%realElementProperties) |
899 |
+ |
this%realElementProperties=>null() |
900 |
+ |
endif |
901 |
+ |
if(associated(this%integerElementProperties)) then |
902 |
+ |
deallocate(this%integerElementProperties) |
903 |
+ |
this%integerElementProperties=>null() |
904 |
+ |
endif |
905 |
+ |
if(associated(this%PropertyDataType)) then |
906 |
+ |
deallocate(this%PropertyDataType) |
907 |
+ |
this%PropertyDataType=>null() |
908 |
+ |
endif |
909 |
+ |
if(associated(this%PropertyDescriptions)) then |
910 |
+ |
deallocate(this%PropertyDescriptions) |
911 |
+ |
this%PropertyDescriptions=>null() |
912 |
+ |
endif |
913 |
+ |
if(associated(this%elementData)) then |
914 |
+ |
deallocate(this%elementData) |
915 |
+ |
this%elementData=>null() |
916 |
+ |
endif |
917 |
+ |
deallocate(this) |
918 |
+ |
this => null() |
919 |
+ |
null_this => null() |
920 |
+ |
end function destroy |
921 |
|
|
839 |
– |
|
922 |
|
end module Vector_class |