j@253: (cl:in-package #:amuse-charm) j@253: j@253: ;;;===================================================================== j@253: ;;; identifiers j@253: ;;;===================================================================== j@253: j@253: (defmethod id ((o constituent-identifier)) j@253: (constituent-id o)) j@253: j@253: (defmethod id ((o constituent)) j@253: (constituent-id (identifier o))) j@253: j@253: (defmethod id ((o event-identifier)) j@253: (event-id o)) j@253: j@253: (defmethod id ((o event)) j@253: (event-id o)) j@253: j@253: (defmethod id ((o composition-identifier)) j@253: (composition-id o)) j@253: j@253: (defmethod id ((o composition)) j@253: (composition-id o)) j@253: j@253: j@253: ;;;===================================================================== j@253: ;;; Specialised constructors j@253: ;;;===================================================================== j@253: j@253: (defmethod make-charm-parent-identifier ((implementation j@253: (eql *package*)) id) j@253: "A Charm constituent parent in this context is just another Charm j@253: constituent, i.e. a constituent has been defined which as a subset of j@253: another (parent) constituent." j@253: (make-charm-constituent-identifier id)) j@253: j@253: (defmethod make-charm-parent-identifier ((implementation j@253: (eql (find-package j@253: "AMUSE-GEERDES"))) id) j@253: "FIXME: This should be in amuse-geerdes" j@253: (amuse-geerdes::g-id-file-id id)) j@253: j@253: (defmethod make-charm-particle-identifier ((impl-package j@253: (eql *package*)) id) j@253: "A CHARM particle in this context is just another CHARM constituent, j@253: i.e. a constituent has been defined which is the union of other j@253: previously defined constituents." j@253: (make-charm-constituent-identifier id)) j@253: j@253: (defmethod make-charm-particle-identifier ((impl-package j@253: (eql (find-package j@253: "AMUSE-GEERDES"))) j@253: id) j@253: "FIXME: This should be in amuse-geerdes" j@253: (amuse-geerdes::make-geerdes-event-identifier id)) j@253: j@253: ;; (defmethod get-charm-particles (constituent-identifier ids j@253: ;; (parent amuse-geerdes::composition)) j@253: ;; "FIXME: This should be in amuse-geerdes" j@253: ;; (amuse-geerdes::select-events-by-ids parent ids)) j@253: j@253: (defmethod get-charm-parent ((constituent-identifier j@253: amuse-geerdes::constituent-identifier)) j@253: (amuse-geerdes::get-composition constituent-identifier)) j@253: j@253: ;; (defmethod %cache-charm-particles ((impl-package (eql *package*)) j@253: ;; constituent) j@253: ;; "hierarchy of constituents not yet implemented!") j@253: j@253: ;; (defmethod %cache-charm-particles ((impl-package (eql (find-package j@253: ;; "AMUSE-GEERDES"))) j@253: ;; constituent) j@253: ;; "FIXME: This should be in amuse-geerdes. This relies on identifier j@253: ;; and particles being in the same order! Better to have generic j@253: ;; functions within each implementation that can take a list of event j@253: ;; identifiers and return a list of events from the database? Or maybe j@253: ;; better still to make compositions proper CHARM constituents so that we j@253: ;; can use 'make-sequence-like'?" j@253: ;; (let ((composition (amuse-geerdes::get-composition j@253: ;; (parent-identifier constituent)))) j@253: ;; (loop with events = (%list-slot-sequence-data composition) j@253: ;; for identifier in (%list-slot-sequence-data constituent) j@253: ;; for event = (loop for events-head on events j@253: ;; until (eq (event-id (car events-head)) j@253: ;; (event-id identifier)) j@253: ;; finally (progn (setf events events-head) j@253: ;; (return (car events-head)))) j@253: ;; collect event into cached-events j@253: ;; finally (progn (setf (particle-cache constituent) j@253: ;; cached-events) j@253: ;; (return constituent)))))