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