Mercurial > hg > amuse
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/base/charm/classes.lisp Thu Feb 24 11:23:18 2011 +0000 @@ -0,0 +1,117 @@ +(cl:in-package #:amuse-charm) + +;;;===================================================================== +;;; Charm-constituents - experimental implementation +;;;===================================================================== + +;;; This aims to bolt on Charm compliance (including database +;;; versioning) to AMuSE constituents as they are currently implmented +;;; (i.e. compositions primarily). However, in order to avoid breaking +;;; existing code, this is not the most tidy of solutions. + +;;;===================================================================== +;;; Charm property lists +;;; +;;; Many things I don't like about this. Using the class hiererchly +;;; for these kinds of properties might be nicer. +;;;===================================================================== + +(defclass charm-property-list (amuse-object list-slot-sequence) ()) + +;;; Or should the lists themselves be typed? + +;; (defclass charm-property (amuse-object) () +;; (:documentation "Base class for charm property objects.")) + +;; (defclass extrinsic-property (charm-property) +;; ((property :reader property +;; :initarg :property +;; :documentation "String specifiying extrinsic property.")) +;; (:documentation "Base class for charm extrinsic properties.")) + +;; (defclass intrinsic-property (charm-property) +;; ((property :reader property +;; :initarg :property +;; :documentation "String describing intrinsic property.")) +;; (:documentation "Base class for charm intrinsic properties.")) + + +;;;===================================================================== +;;; Charm constituent identifier +;;;===================================================================== + +(defclass charm-constituent-identifier (constituent-identifier) + ((constituent-id :reader constituent-id + :initarg :constituent-id)) + (:documentation "Class to represent Charm constituent identifiers.")) + + +;;;===================================================================== +;;; Charm constituents +;;;===================================================================== + +(defclass charm-constituent (list-slot-sequence anchored-period) + ((identifier :accessor identifier + :initarg :identifier + :initform nil + :documentation "Slot to store the constituent + identifier containing the constituent's database ID, + which is allocated automatically when inserted into the + database.") +;; (parent-identifier :reader parent-identifier +;; :initarg :parent-identifier +;; :documentation "Slot to store the identifer for +;; the constituent from which the particles of this +;; constituent are also members. May either be +;; another Charm constituent or an AMuSE +;; composition.") + (parent :reader parent + :initarg :parent + :documentation "Slot to store the constituent from which + the particles of this constituent are also members. May + either be another Charm constituent or an AMuSE + composition.") + (extrinsic-properties :reader extrinsic-properties + :initarg :extrinsic-properties + :documentation "Slot for the specification of + extrinsic properties.") + (intrinsic-properties :reader intrinsic-properties + :initarg :intrinsic-properties + :documentation "Slot for the description of + intrinsic properties.") +;; (particles-cache :accessor particles-cache ;; FIXME: why bother? +;; :initarg :particles-cache +;; :initform nil +;; :documentation "Slot to store the objects +;; identifier by the particles-identifiers.") + (owner :accessor owner + :initarg :owner + :initform nil) + (version :accessor version + :initarg :version + :initform nil) + (creation-timestamp :accessor creation-timestamp + :initarg :creation-timestamp + :initform nil) + (deletion-timestamp :accessor deletion-timestamp + :initarg :deletion-timestamp + :initform nil)) + (:documentation "Base class for constituents")) + +(defclass standard-charm-constituent (charm-constituent + standard-anchored-period) () + (:documentation "Base class for constituents using standard time + representation.")) + +(defmethod initialize-instance :after ((constituent + standard-charm-constituent) &key) + (amuse::%recompute-standard-composition-period constituent)) + +(defmethod (setf %list-slot-sequence-data) :after (new-value object) + (declare (ignore new-value)) + (amuse::%recompute-standard-composition-period object)) + +(defclass standard-charm-event-constituent (standard-charm-constituent) + () + (:documentation "Base class for constituents using standard time + representation."))