annotate base/charm/methods.lisp @ 258:aac79c0ac1b9

add within-short-bar-p, and use this to correctly calculate the ioi-from-bar of anacruses
author Jamie Forth <j.forth@gold.ac.uk>
date Thu, 24 Feb 2011 18:50:38 +0000
parents b5ffec94ae6d
children
rev   line source
j@253 1 (cl:in-package #:amuse-charm)
j@253 2
j@253 3 ;;;=====================================================================
j@253 4 ;;; identifiers
j@253 5 ;;;=====================================================================
j@253 6
j@253 7 (defmethod id ((o constituent-identifier))
j@253 8 (constituent-id o))
j@253 9
j@253 10 (defmethod id ((o constituent))
j@253 11 (constituent-id (identifier o)))
j@253 12
j@253 13 (defmethod id ((o event-identifier))
j@253 14 (event-id o))
j@253 15
j@253 16 (defmethod id ((o event))
j@253 17 (event-id o))
j@253 18
j@253 19 (defmethod id ((o composition-identifier))
j@253 20 (composition-id o))
j@253 21
j@253 22 (defmethod id ((o composition))
j@253 23 (composition-id o))
j@253 24
j@253 25
j@253 26 ;;;=====================================================================
j@253 27 ;;; Specialised constructors
j@253 28 ;;;=====================================================================
j@253 29
j@253 30 (defmethod make-charm-parent-identifier ((implementation
j@253 31 (eql *package*)) id)
j@253 32 "A Charm constituent parent in this context is just another Charm
j@253 33 constituent, i.e. a constituent has been defined which as a subset of
j@253 34 another (parent) constituent."
j@253 35 (make-charm-constituent-identifier id))
j@253 36
j@253 37 (defmethod make-charm-parent-identifier ((implementation
j@253 38 (eql (find-package
j@253 39 "AMUSE-GEERDES"))) id)
j@253 40 "FIXME: This should be in amuse-geerdes"
j@253 41 (amuse-geerdes::g-id-file-id id))
j@253 42
j@253 43 (defmethod make-charm-particle-identifier ((impl-package
j@253 44 (eql *package*)) id)
j@253 45 "A CHARM particle in this context is just another CHARM constituent,
j@253 46 i.e. a constituent has been defined which is the union of other
j@253 47 previously defined constituents."
j@253 48 (make-charm-constituent-identifier id))
j@253 49
j@253 50 (defmethod make-charm-particle-identifier ((impl-package
j@253 51 (eql (find-package
j@253 52 "AMUSE-GEERDES")))
j@253 53 id)
j@253 54 "FIXME: This should be in amuse-geerdes"
j@253 55 (amuse-geerdes::make-geerdes-event-identifier id))
j@253 56
j@253 57 ;; (defmethod get-charm-particles (constituent-identifier ids
j@253 58 ;; (parent amuse-geerdes::composition))
j@253 59 ;; "FIXME: This should be in amuse-geerdes"
j@253 60 ;; (amuse-geerdes::select-events-by-ids parent ids))
j@253 61
j@253 62 (defmethod get-charm-parent ((constituent-identifier
j@253 63 amuse-geerdes::constituent-identifier))
j@253 64 (amuse-geerdes::get-composition constituent-identifier))
j@253 65
j@253 66 ;; (defmethod %cache-charm-particles ((impl-package (eql *package*))
j@253 67 ;; constituent)
j@253 68 ;; "hierarchy of constituents not yet implemented!")
j@253 69
j@253 70 ;; (defmethod %cache-charm-particles ((impl-package (eql (find-package
j@253 71 ;; "AMUSE-GEERDES")))
j@253 72 ;; constituent)
j@253 73 ;; "FIXME: This should be in amuse-geerdes. This relies on identifier
j@253 74 ;; and particles being in the same order! Better to have generic
j@253 75 ;; functions within each implementation that can take a list of event
j@253 76 ;; identifiers and return a list of events from the database? Or maybe
j@253 77 ;; better still to make compositions proper CHARM constituents so that we
j@253 78 ;; can use 'make-sequence-like'?"
j@253 79 ;; (let ((composition (amuse-geerdes::get-composition
j@253 80 ;; (parent-identifier constituent))))
j@253 81 ;; (loop with events = (%list-slot-sequence-data composition)
j@253 82 ;; for identifier in (%list-slot-sequence-data constituent)
j@253 83 ;; for event = (loop for events-head on events
j@253 84 ;; until (eq (event-id (car events-head))
j@253 85 ;; (event-id identifier))
j@253 86 ;; finally (progn (setf events events-head)
j@253 87 ;; (return (car events-head))))
j@253 88 ;; collect event into cached-events
j@253 89 ;; finally (progn (setf (particle-cache constituent)
j@253 90 ;; cached-events)
j@253 91 ;; (return constituent)))))