annotate base/database/charm/classes.lisp @ 318:c4e792b9b898

Add some ideas for charm constituents. Not particularly useful in its own right, but contains some possibly useful ideas related to the generalisation of db-compositions.
author Jamie Forth <j.forth@gold.ac.uk>
date Thu, 30 Sep 2010 15:35:15 +0100
parents
children
rev   line source
j@318 1 (cl:in-package #:amuse-charm)
j@318 2
j@318 3 ;;;=====================================================================
j@318 4 ;;; Charm-constituents - experimental implementation
j@318 5 ;;;=====================================================================
j@318 6
j@318 7 ;; This aims to bolt on Charm compliance to AMuSE constituents, as
j@318 8 ;; they are currently implmented (i.e. compositions
j@318 9 ;; primarily). However, in order to avoid breaking existing code, this
j@318 10 ;; is not the most tidy of solutions.
j@318 11
j@318 12 ;;;=====================================================================
j@318 13 ;;; Charm property lists
j@318 14 ;;;=====================================================================
j@318 15
j@318 16 (defclass charm-property-list (amuse-object list-slot-sequence) ())
j@318 17
j@318 18 ;; (defclass charm-property (amuse-object) ()
j@318 19 ;; (:documentation "Base class for charm property objects."))
j@318 20
j@318 21 ;; (defclass extrinsic-property (charm-property)
j@318 22 ;; ((property :reader property
j@318 23 ;; :initarg :property
j@318 24 ;; :documentation "String specifiying extrinsic property."))
j@318 25 ;; (:documentation "Base class for charm extrinsic properties."))
j@318 26
j@318 27 ;; (defclass intrinsic-property (charm-property)
j@318 28 ;; ((property :reader property
j@318 29 ;; :initarg :property
j@318 30 ;; :documentation "String describing intrinsic property."))
j@318 31 ;; (:documentation "Base class for charm intrinsic properties."))
j@318 32
j@318 33
j@318 34 ;;;=====================================================================
j@318 35 ;;; Charm constituent identifier
j@318 36 ;;;=====================================================================
j@318 37
j@318 38 (defclass charm-constituent-identifier (constituent-identifier)
j@318 39 ((constituent-id :reader constituent-id
j@318 40 :initarg :constituent-id))
j@318 41 (:documentation "Class to represent Charm constituent identifiers."))
j@318 42
j@318 43 ;;;=====================================================================
j@318 44 ;;; Charm constituents
j@318 45 ;;;=====================================================================
j@318 46
j@318 47 (defclass charm-constituent (list-slot-sequence anchored-period)
j@318 48 ((identifier :accessor identifier
j@318 49 :initarg :identifier
j@318 50 :initform nil
j@318 51 :documentation "Slot to store database ID, allocated
j@318 52 automatically when inserted into the database.")
j@318 53 ;; (parent-identifier :reader parent-identifier
j@318 54 ;; :initarg :parent-identifier
j@318 55 ;; :documentation "Slot to store the identifer for
j@318 56 ;; the constituent from which the particles of this
j@318 57 ;; constituent are also members. May either be
j@318 58 ;; another Charm constituent or an AMuSE
j@318 59 ;; composition.")
j@318 60 (parent :reader parent
j@318 61 :initarg :parent
j@318 62 :documentation "Slot to store the constituent from which
j@318 63 the particles of this constituent are also members. May
j@318 64 either be another Charm constituent or an AMuSE
j@318 65 composition.")
j@318 66 (extrinsic-properties :reader extrinsic-properties
j@318 67 :initarg :extrinsic-properties
j@318 68 :documentation "Slot for the specification of
j@318 69 extrinsic properties.")
j@318 70 (intrinsic-properties :reader intrinsic-properties
j@318 71 :initarg :intrinsic-properties
j@318 72 :documentation "Slot for the description of
j@318 73 intrinsic properties.")
j@318 74 ;; (particles-cache :accessor particles-cache ;; FIXME: why bother?
j@318 75 ;; :initarg :particles-cache
j@318 76 ;; :initform nil
j@318 77 ;; :documentation "Slot to store the objects
j@318 78 ;; identifier by the particles-identifiers.")
j@318 79 (owner :accessor owner ;FIXME: these slots should be inherited.
j@318 80 :initarg :owner
j@318 81 :initform nil)
j@318 82 (version :accessor version
j@318 83 :initarg :version
j@318 84 :initform nil)
j@318 85 (creation-timestamp :accessor creation-timestamp
j@318 86 :initarg :creation-timestamp
j@318 87 :initform nil)
j@318 88 (deletion-timestamp :accessor deletion-timestamp
j@318 89 :initarg :deletion-timestamp
j@318 90 :initform nil))
j@318 91 (:documentation "Base class for constituents"))
j@318 92
j@318 93 (defclass standard-charm-constituent (charm-constituent
j@318 94 standard-anchored-period) ()
j@318 95 (:documentation "Base class for constituents using standard time
j@318 96 representation."))
j@318 97
j@318 98 (defclass standard-charm-event-constituent (standard-charm-constituent) ()
j@318 99 (:documentation "Base class for constituents using standard time
j@318 100 representation."))
j@318 101
j@318 102 (defmethod initialize-instance :after ((constituent
j@318 103 standard-charm-constituent) &key)
j@318 104 (amuse::%recompute-standard-composition-period constituent))
j@318 105
j@318 106 (defmethod (setf %list-slot-sequence-data) :after (new-value object)
j@318 107 "FIXME: :after is right, right? What is :around for again?"
j@318 108 (declare (ignore new-value))
j@318 109 (amuse::%recompute-standard-composition-period object))