j@253
|
1 (cl:in-package #:amuse-charm)
|
j@253
|
2
|
j@253
|
3 ;;;=====================================================================
|
j@253
|
4 ;;; Charm-constituents - experimental implementation
|
j@253
|
5 ;;;=====================================================================
|
j@253
|
6
|
j@253
|
7 ;;; This aims to bolt on Charm compliance (including database
|
j@253
|
8 ;;; versioning) to AMuSE constituents as they are currently implmented
|
j@253
|
9 ;;; (i.e. compositions primarily). However, in order to avoid breaking
|
j@253
|
10 ;;; existing code, this is not the most tidy of solutions.
|
j@253
|
11
|
j@253
|
12 ;;;=====================================================================
|
j@253
|
13 ;;; Charm property lists
|
j@253
|
14 ;;;
|
j@253
|
15 ;;; Many things I don't like about this. Using the class hiererchly
|
j@253
|
16 ;;; for these kinds of properties might be nicer.
|
j@253
|
17 ;;;=====================================================================
|
j@253
|
18
|
j@253
|
19 (defclass charm-property-list (amuse-object list-slot-sequence) ())
|
j@253
|
20
|
j@253
|
21 ;;; Or should the lists themselves be typed?
|
j@253
|
22
|
j@253
|
23 ;; (defclass charm-property (amuse-object) ()
|
j@253
|
24 ;; (:documentation "Base class for charm property objects."))
|
j@253
|
25
|
j@253
|
26 ;; (defclass extrinsic-property (charm-property)
|
j@253
|
27 ;; ((property :reader property
|
j@253
|
28 ;; :initarg :property
|
j@253
|
29 ;; :documentation "String specifiying extrinsic property."))
|
j@253
|
30 ;; (:documentation "Base class for charm extrinsic properties."))
|
j@253
|
31
|
j@253
|
32 ;; (defclass intrinsic-property (charm-property)
|
j@253
|
33 ;; ((property :reader property
|
j@253
|
34 ;; :initarg :property
|
j@253
|
35 ;; :documentation "String describing intrinsic property."))
|
j@253
|
36 ;; (:documentation "Base class for charm intrinsic properties."))
|
j@253
|
37
|
j@253
|
38
|
j@253
|
39 ;;;=====================================================================
|
j@253
|
40 ;;; Charm constituent identifier
|
j@253
|
41 ;;;=====================================================================
|
j@253
|
42
|
j@253
|
43 (defclass charm-constituent-identifier (constituent-identifier)
|
j@253
|
44 ((constituent-id :reader constituent-id
|
j@253
|
45 :initarg :constituent-id))
|
j@253
|
46 (:documentation "Class to represent Charm constituent identifiers."))
|
j@253
|
47
|
j@253
|
48
|
j@253
|
49 ;;;=====================================================================
|
j@253
|
50 ;;; Charm constituents
|
j@253
|
51 ;;;=====================================================================
|
j@253
|
52
|
j@253
|
53 (defclass charm-constituent (list-slot-sequence anchored-period)
|
j@253
|
54 ((identifier :accessor identifier
|
j@253
|
55 :initarg :identifier
|
j@253
|
56 :initform nil
|
j@253
|
57 :documentation "Slot to store the constituent
|
j@253
|
58 identifier containing the constituent's database ID,
|
j@253
|
59 which is allocated automatically when inserted into the
|
j@253
|
60 database.")
|
j@253
|
61 ;; (parent-identifier :reader parent-identifier
|
j@253
|
62 ;; :initarg :parent-identifier
|
j@253
|
63 ;; :documentation "Slot to store the identifer for
|
j@253
|
64 ;; the constituent from which the particles of this
|
j@253
|
65 ;; constituent are also members. May either be
|
j@253
|
66 ;; another Charm constituent or an AMuSE
|
j@253
|
67 ;; composition.")
|
j@253
|
68 (parent :reader parent
|
j@253
|
69 :initarg :parent
|
j@253
|
70 :documentation "Slot to store the constituent from which
|
j@253
|
71 the particles of this constituent are also members. May
|
j@253
|
72 either be another Charm constituent or an AMuSE
|
j@253
|
73 composition.")
|
j@253
|
74 (extrinsic-properties :reader extrinsic-properties
|
j@253
|
75 :initarg :extrinsic-properties
|
j@253
|
76 :documentation "Slot for the specification of
|
j@253
|
77 extrinsic properties.")
|
j@253
|
78 (intrinsic-properties :reader intrinsic-properties
|
j@253
|
79 :initarg :intrinsic-properties
|
j@253
|
80 :documentation "Slot for the description of
|
j@253
|
81 intrinsic properties.")
|
j@253
|
82 ;; (particles-cache :accessor particles-cache ;; FIXME: why bother?
|
j@253
|
83 ;; :initarg :particles-cache
|
j@253
|
84 ;; :initform nil
|
j@253
|
85 ;; :documentation "Slot to store the objects
|
j@253
|
86 ;; identifier by the particles-identifiers.")
|
j@253
|
87 (owner :accessor owner
|
j@253
|
88 :initarg :owner
|
j@253
|
89 :initform nil)
|
j@253
|
90 (version :accessor version
|
j@253
|
91 :initarg :version
|
j@253
|
92 :initform nil)
|
j@253
|
93 (creation-timestamp :accessor creation-timestamp
|
j@253
|
94 :initarg :creation-timestamp
|
j@253
|
95 :initform nil)
|
j@253
|
96 (deletion-timestamp :accessor deletion-timestamp
|
j@253
|
97 :initarg :deletion-timestamp
|
j@253
|
98 :initform nil))
|
j@253
|
99 (:documentation "Base class for constituents"))
|
j@253
|
100
|
j@253
|
101 (defclass standard-charm-constituent (charm-constituent
|
j@253
|
102 standard-anchored-period) ()
|
j@253
|
103 (:documentation "Base class for constituents using standard time
|
j@253
|
104 representation."))
|
j@253
|
105
|
j@253
|
106 (defmethod initialize-instance :after ((constituent
|
j@253
|
107 standard-charm-constituent) &key)
|
j@253
|
108 (amuse::%recompute-standard-composition-period constituent))
|
j@253
|
109
|
j@253
|
110 (defmethod (setf %list-slot-sequence-data) :after (new-value object)
|
j@253
|
111 (declare (ignore new-value))
|
j@253
|
112 (amuse::%recompute-standard-composition-period object))
|
j@253
|
113
|
j@253
|
114 (defclass standard-charm-event-constituent (standard-charm-constituent)
|
j@253
|
115 ()
|
j@253
|
116 (:documentation "Base class for constituents using standard time
|
j@253
|
117 representation."))
|