| 1 | package Physics::UEMColumn::Element; | ||
| 2 | |||
| 3 | use Moose; | ||
| 4 | use namespace::autoclean; | ||
| 5 | |||
| 6 | use Method::Signatures; | ||
| 7 | |||
| 8 | use MooseX::Types::NumUnit qw/num_of_unit/; | ||
| 9 | my $meters = num_of_unit('m'); | ||
| 10 | |||
| 11 | has 'location' => ( isa => $meters, is => 'ro', required => 1); | ||
| 12 | has 'length' => ( isa => $meters, is => 'ro', required => 1); | ||
| 13 | |||
| 14 | has 'cutoff' => ( isa => 'Num', is => 'ro', default => 3); # relative distance to ignore effect | ||
| 15 | |||
| 16 | method effect () { | ||
| 17 | # return an hashref with code for M_t, M_z and acc_z | ||
| 18 | return {}; | ||
| 19 | } | ||
| 20 | |||
| 21 | __PACKAGE__->meta->make_immutable; | ||
| 22 | |||
| 23 | 1; | ||
| 24 | |||
| 25 | =head1 NAME | ||
| 26 | |||
| 27 | Physics::UEMColumn::Element - Base class for "optical" elements in a UEM system | ||
| 28 | |||
| 29 | =head1 SYNOPSIS | ||
| 30 | |||
| 31 | package Physics::UEMColumn::MyElement; | ||
| 32 | use Moose; | ||
| 33 | extends 'Physics::UEMColumn::Element'; | ||
| 34 | |||
| 35 | =head1 DESCRIPTION | ||
| 36 | |||
| 37 | L<Physics::UEMColumn::Element> is a base class for "optical" elements in a UEM system. Mostly it defines the physical bounds of the element. All objects passed to L<Physics::UEMColumn::Column> via C<add_element> must be subclasses of this base. | ||
| 38 | |||
| 39 | =head1 ATTRIBUTES | ||
| 40 | |||
| 41 | =over | ||
| 42 | |||
| 43 | =item C<location> | ||
| 44 | |||
| 45 | The position of the center of the element in the column. Unit: m | ||
| 46 | |||
| 47 | =item C<length> | ||
| 48 | |||
| 49 | The full effective length of the element. "Effective" here means the size that the pulse sees; e.g. the length of the pole piece gap of a magnetic lens. Unit: m | ||
| 50 | |||
| 51 | =item C<cutoff> | ||
| 52 | |||
| 53 | A number representing the number of C<length>s away from the the center of the element before the element may be safely ignored. The default is C<3>. | ||
| 54 | |||
| 55 | =back | ||
| 56 | |||
| 57 | =head1 METHODS | ||
| 58 | |||
| 59 | =over | ||
| 60 | |||
| 61 | =item C<effect> | ||
| 62 | |||
| 63 | Returns a hash reference of subroutine references defining the effect that the element has on a pulse's width (C<M_t>), length (C<M_z>) and velocity (C<acc_z>). These subroutine references expect arguments of time, pulse position and pulse velocity (C<t>, C<z>, C<v>), they return a number quantifying this effect. The base class simply returns an empty hash reference. This method is intended to be redefined on subclassing. | ||
| 64 | |||
| 65 | =back | ||
| 66 | |||
| 67 | =head1 SOURCE REPOSITORY | ||
| 68 | |||
| 69 | L<http://github.com/jberger/Physics-UEMColumn> | ||
| 70 | |||
| 71 | =head1 AUTHOR | ||
| 72 | |||
| 73 | Joel Berger, E<lt>joel.a.berger@gmail.comE<gt> | ||
| 74 | |||
| 75 | =head1 COPYRIGHT AND LICENSE | ||
| 76 | |||
| 77 | Copyright (C) 2012-2013 by Joel Berger | ||
| 78 | |||
| 79 | This library is free software; you can redistribute it and/or modify | ||
| 80 | it under the same terms as Perl itself. |