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