casacore
MSTileLayout.h
Go to the documentation of this file.
1 //# MSTileLayout.h: Determine appropriate tiling for a MeasurementSet
2 //# Copyright (C) 2002
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef MS_MSTILELAYOUT_H
29 #define MS_MSTILELAYOUT_H
30 
31 #include <casacore/casa/aips.h>
32 
33 namespace casacore { //# NAMESPACE CASACORE - BEGIN
34 
35 //# forward decl
36 class IPosition;
37 class String;
38 
39 // <summary>
40 // An helper class for deciding on tile shapes in MeasurementSets
41 // </summary>
42 
43 // <use visibility=export>
44 
45 // <prerequisite>
46 // <li> <linkto class="MeasurementSet:description">MeasurementSet</linkto>
47 // <li> <linkto class="TiledStMan:description">TiledStMan</linkto>
48 // </prerequisite>
49 //
50 // <etymology>
51 // MSTileLayout stands for the MeasurementSet tile layout chooser
52 // </etymology>
53 //
54 // <synopsis>
55 // MSTileLayout is a class to determine an appropriate tile shape choice
56 // for the MeasurementSet DATA columns, based on the shape of the DATA,
57 // the observing mode and the number of interferometers
58 // </synopsis>
59 //
60 // <example>
61 // <srcblock>
62 // // The following code returns the tile shape given the DATA shape,
63 // // the observing type and the array name.
64 // IPosition dataShape(2,4,1024); // 4 polarizations, 1024 channels
65 // IPosition tileShape = MSTileLayout::tileShape(dataShape,
66 // MSTileLayout::FastMosaic,
67 // "ATCA");
68 // cout << "tileShape = "<< tileShape << endl;
69 // // Output is:
70 // tileShape = (4,11,15)
71 // </srcblock>
72 // </example>
73 
74 // <motivation>
75 // This class is intended to replace bits of code scattered throughout various
76 // fillers and collect all tiling decisions in one place.
77 // </motivation>
78 //
79 // <todo>
80 // </todo>
81 
83 {
84 public:
85  enum ObsType {
86  // Standard, optimizes i/o by using large tiles (128 kB)
88  // Fast Mosaic, specify this if you have many (>30) fields and you
89  // spend only a few integrations per pointing before moving on.
90  // Avoids useless i/o caching by using small tiles
91  FastMosaic=1
92  };
93 
94  // Suggest tile shape based on the data shape, the observing mode,
95  // the number of interferometers and the number of integrations per
96  // pointing.
97  //
98  // First argument should be a 2-dimensional IPosition with the data matrix
99  // shape.
100  // The second argument is one of the enums above specifying the type of
101  // observation.
102  // The third argument is an estimate of the number of interferometers
103  // present throughout most of the data.
104  // The last argument is an estimate of the number of integrations per
105  // pointing.
106  //
107  // The last three arguments only need to be specified if the observing mode
108  // is non Standard.
109  // Basically the choice is between large tiles for efficient I/O and small
110  // tiles when a common access pattern (field_id order) would result
111  // in very inefficient caching. The latter occurs for large tiles if the
112  // field_id changes rapidly AND there are many fields AND the data
113  // matrix is small (e.g., continuum mosaic of a large area with only
114  // one or two integrations per pointing). Note that accessing fast mosaic
115  // data with large tiles in field_id order can be 10-100 times slower than
116  // sequential access.
117  static IPosition tileShape(const IPosition& dataShape,
118  Int observationType = Standard,
119  Int nIfr = 0, Int nInt = 1);
120 
121  // same as above, but pick standard nIfr (number of interferometers)
122  // for named array and default nInt.
123  static IPosition tileShape(const IPosition& dataShape,
124  Int observationType,
125  const String& array);
126 };
127 
128 
129 } //# NAMESPACE CASACORE - END
130 
131 #endif
static IPosition tileShape(const IPosition &dataShape, Int observationType, const String &array)
same as above, but pick standard nIfr (number of interferometers) for named array and default nInt.
static IPosition tileShape(const IPosition &dataShape, Int observationType=Standard, Int nIfr=0, Int nInt=1)
Suggest tile shape based on the data shape, the observing mode, the number of interferometers and the...
@ Standard
Standard, optimizes i/o by using large tiles (128 kB)
Definition: MSTileLayout.h:87
@ FastMosaic
Fast Mosaic, specify this if you have many (>30) fields and you spend only a few integrations per poi...
Definition: MSTileLayout.h:91
String: the storage and methods of handling collections of characters.
Definition: String.h:225
this file contains all the compiler specific defines
Definition: mainpage.dox:28
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
Definition: ExprNode.h:1929
int Int
Definition: aipstype.h:50