view base/charm/classes.lisp @ 265:b75b45d76e45

add ioi-from-bar method to amuse-mtp
author Jamie Forth <j.forth@gold.ac.uk>
date Sun, 10 Apr 2011 16:59:24 +0100
parents 5090d02f7a83
children
line wrap: on
line source
(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 standard-charm-constituent) :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."))

(defclass standard-charm-pitched-event-constituent
    (standard-charm-event-constituent)
  ()
  (:documentation "Base class for constituents using standard time
  representation containing only pitched events."))

(defclass standard-charm-unpitched-event-constituent (standard-charm-event-constituent)
  ()
  (:documentation "Base class for constituents using standard time
   representation containing only unpitched events."))