source: branches/parallel/src/FillerBase.h@ 2317

Last change on this file since 2317 was 2263, checked in by Takeshi Nakazato, 13 years ago

New Development: No

JIRA Issue: No

Ready for Test: No

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Tuning NROFiller.
Filler is about 6 times faster than before (~660sec->~110sec).

File size: 4.2 KB
RevLine 
[1778]1//
2// C++ Interface: FillerBase
3//
4// Description:
5//
6// This class is the Base class for all data fillers.
7// The derived filler needs to implement
8// open()
9// close()
10// fill()
11//
12// The fill() method usually iterates over the source data and calls
13// the setXYZ() methods for. After all the data for a row has been set via
14// these methods, the fill() method needs to call commitRow() to write the
15// data to the scantable.
16// All arguments which are defaulted in the setXYZ() methods are optional. All
17// others should be set explicitly.
18//
19// Author: Malte Marquarding <asap@atnf.csiro.au>, (C) 2010
20//
21// Copyright: See COPYING file that comes with this distribution
22//
23//
24#ifndef ASAPFILLERBASE_H
25#define ASAPFILLERBASE_H
26
27// STL
28#include <string>
[2263]29#include <vector>
[1778]30// AIPS++
31#include <casa/aips.h>
[1780]32#include <casa/Utilities/CountedPtr.h>
33#include <casa/Arrays/Vector.h>
34#include <tables/Tables/TableRow.h>
35#include "Scantable.h"
[1778]36
37namespace asap
38{
39
40class FillerBase
41{
42 public:
[1786]43 explicit FillerBase(casa::CountedPtr<Scantable> stable);
[1795]44 virtual ~FillerBase() {;}
[1778]45
[1904]46 virtual bool open(const std::string& filename, const casa::Record& rec) = 0;
47 // virtual bool open(const std::string& filename) = 0;
[1778]48 virtual void fill() = 0;
49 virtual void close() = 0;
50
[1786]51 void setReferenceRegex(const std::string& rx) { referenceRx_ = rx; }
[1793]52 std::string getReferenceRegex() { return referenceRx_; }
[1786]53
[1778]54 protected:
55
56 void commitRow();
[1803]57 void setHeader(const STHeader& header);
58 void setSpectrum(const casa::Vector<casa::Float>& spectrum,
[1788]59 const casa::Vector<casa::uChar>& flags,
[1803]60 const casa::Vector<casa::Float>& tsys);
61 void setFlagrow(casa::uInt flag);
62 void setOpacity(casa::Float opacity=0.0f);
63 void setIndex(casa::uInt scanno, casa::uInt cycleno,
[1780]64 casa::uInt ifno, casa::uInt polno,
65 casa::uInt beamno=0);
[1803]66 void setFrequency(casa::Double refpix, casa::Double refval,
[1778]67 casa::Double incr);
[1803]68 void setMolecule(const casa::Vector<casa::Double>& restfreq);
69 void setDirection(const casa::Vector<casa::Double>& dir,
[1778]70 casa::Float az=0.0f, casa::Float el=0.0f);
71
[1803]72 void setFocus(casa::Float pa=0.0f, casa::Float faxis=0.0f,
[1780]73 casa::Float ftan=0.0f, casa::Float frot=0.0f);
[1803]74 void setTime(casa::Double mjd, casa::Double integration);
75 void setWeather(casa::Float temperature=0.0f,
[1778]76 casa::Float pressure=0.0f,
77 casa::Float humidity=0.0f,
78 casa::Float windspeed=0.0f,
79 casa::Float windaz=0.0f);
[2247]80 void setWeather2(casa::Float temperature=0.0f,
81 casa::Float pressure=0.0f,
82 casa::Float humidity=0.0f,
83 casa::Float windspeed=0.0f,
84 casa::Float windaz=0.0f);
[1803]85 void setTcal(const casa::String& caltime="",
[1780]86 const casa::Vector<casa::Float>& tcal=casa::Vector<casa::Float>());
[2247]87 void setTcal2(const casa::String& caltime="",
88 const casa::Vector<casa::Float>& tcal=casa::Vector<casa::Float>());
[1803]89 void setScanRate(const casa::Vector<casa::Double>& srate=casa::Vector<casa::Double>());
90 void setReferenceBeam(casa::Int beamno=-1);
91 void setSource(const std::string& name, casa::Int type,
[1778]92 const std::string& fieldname="",
[1780]93 const casa::Vector<casa::Double>& dir=casa::Vector<casa::Double>(),
94 const casa::Vector<casa::Double>& propermot=casa::Vector<casa::Double>(),
95 casa::Double velocity=0.0);
[1778]96
[1793]97 casa::CountedPtr< Scantable > table_;
[1795]98
[1778]99 private:
100
[1811]101 FillerBase();
102 FillerBase(const FillerBase&);
103 FillerBase& operator=(const FillerBase&);
[1778]104 casa::String referenceRx_;
105 casa::TableRow row_;
[2263]106
107 std::vector< casa::Vector<casa::Double> > mEntry_ ;
108 std::vector<casa::uInt> mIdx_ ;
109 std::vector< casa::Vector<casa::Double> > fEntry_ ;
110 std::vector<casa::uInt> fIdx_ ;
111 std::vector< casa::Vector<casa::Float> > wEntry_ ;
112 std::vector<casa::uInt> wIdx_ ;
[1780]113};
[1778]114
115
116};
[1780]117#endif
Note: See TracBrowser for help on using the repository browser.