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