File indexing completed on 2025-01-30 10:03:26
0001 #include <vector>
0002 namespace Genfun {
0003
0004 class LegendreCoefficientSet::Clockwork {
0005
0006 public:
0007
0008 std::vector<std::complex<double> > data;
0009
0010 };
0011
0012 inline
0013 LegendreCoefficientSet::LegendreCoefficientSet(unsigned int LMAX):c(new Clockwork()){
0014 for (unsigned int l=0;l<=LMAX;l++) {
0015 c->data.push_back(0);
0016 }
0017 }
0018
0019 inline
0020 LegendreCoefficientSet::~LegendreCoefficientSet(){
0021 delete c;
0022 }
0023
0024 inline
0025 LegendreCoefficientSet::LegendreCoefficientSet(const LegendreCoefficientSet & right):
0026 c(new Clockwork(*right.c))
0027 {
0028 }
0029
0030 inline
0031 unsigned int LegendreCoefficientSet::getLMax() const {
0032 return c->data.size()-1;
0033 }
0034
0035 inline
0036 const std::complex<double> &LegendreCoefficientSet:: operator () (unsigned int l) const {
0037 return c->data[l];
0038 }
0039
0040 inline
0041 std::complex<double> & LegendreCoefficientSet::operator () (unsigned int l) {
0042 return c->data[l];
0043 }
0044
0045 inline
0046 std::ostream & operator << ( std::ostream & o, const LegendreCoefficientSet & c)
0047 {
0048 for (unsigned int l=0;l<=c.getLMax();l++) {
0049 o << l << " mag: " << c(l) << std::endl;
0050 }
0051 o << std::endl;
0052 return o;
0053 }
0054
0055 inline
0056 LegendreCoefficientSet & LegendreCoefficientSet::operator= (const LegendreCoefficientSet & source ){
0057 if (this!=&source) {
0058 delete c;
0059 c = new Clockwork(*source.c);
0060 }
0061 return *this;
0062 }
0063 }