comparison base/charm/functions.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 (in-package #:amuse-charm)
2
3 ;;;=====================================================================
4 ;;; Helpful functions
5 ;;;=====================================================================
6
7 (defun find-first-onset (events)
8 (reduce #'min events :key #'timepoint))
9
10 (defun find-last-offset (events)
11 (reduce #'max events :key #'(lambda (event)
12 (timepoint (cut-off event)))))
13
14 (defgeneric object->db-string (o))
15
16 (defmethod object->db-string ((o charm-property-list))
17 (format nil "~S" (%list-slot-sequence-data o)))
18
19 (defmethod object->db-string ((o event-identifier))
20 "This was an earlier approach, that was probably bad."
21 "e")
22
23 (defmethod object->db-string ((o constituent-identifier))
24 "This was an earlier approach, that was probably bad."
25 "c")
26
27 (defun recompute-constituent-timepoint (constituent)
28 (setf (timepoint constituent)
29 (reduce #'min constituent :key 'timepoint)))
30
31 (defun recompute-constituent-duration (constituent)
32 (setf (duration constituent)
33 (reduce #'max constituent :key 'timepoint)))