Line data Source code
1 : // -*- C++ -*-
2 : //# FortranizedLoopsToGrid.cc: Code to call the gridding inner-loops
3 : //# written in FORTRAN
4 : //# Copyright (C) 1997,1998,1999,2000,2001,2002,2003
5 : //# Associated Universities, Inc. Washington DC, USA.
6 : //#
7 : //# This library is free software; you can redistribute it and/or modify it
8 : //# under the terms of the GNU Library General Public License as published by
9 : //# the Free Software Foundation; either version 2 of the License, or (at your
10 : //# option) any later version.
11 : //#
12 : //# This library is distributed in the hope that it will be useful, but WITHOUT
13 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15 : //# License for more details.
16 : //#
17 : //# You should have received a copy of the GNU Library General Public License
18 : //# along with this library; if not, write to the Free Software Foundation,
19 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
20 : //#
21 : //# Correspondence concerning AIPS++ should be addressed as follows:
22 : //# Internet email: aips2-request@nrao.edu.
23 : //# Postal address: AIPS++ Project Office
24 : //# National Radio Astronomy Observatory
25 : //# 520 Edgemont Road
26 : //# Charlottesville, VA 22903-2475 USA
27 : //#
28 : //# $Id$
29 :
30 : {
31 0 : timer_p.mark();
32 : // T *gridPtr;
33 : Complex *cfPtr, *phaseGradPtr;
34 : Int *supportPtr, *cfShapePtr,
35 : *locPtr, *igrdposPtr, *ilocPtr, *tilocPtr,
36 : *convOriginPtr;
37 : Float *samplingPtr;
38 : Double *offPtr;
39 : Bool dummy;
40 : // gridPtr = grid.getStorage(dummy);
41 0 : cfPtr = convFuncV;
42 0 : phaseGradPtr = cached_phaseGrad_p.getStorage(dummy);
43 0 : supportPtr = support.getStorage(dummy);
44 0 : samplingPtr = sampling.getStorage(dummy);
45 0 : cfShapePtr = cfShape.getStorage(dummy);
46 0 : locPtr = loc.getStorage(dummy);
47 0 : igrdposPtr = igrdpos.getStorage(dummy);
48 0 : ilocPtr = iloc.getStorage(dummy);
49 0 : tilocPtr = tiloc.getStorage(dummy);
50 0 : offPtr = off.getStorage(dummy);
51 0 : convOriginPtr = convOrigin.getStorage(dummy);
52 : (void)cfPtr;
53 : (void)ilocPtr;
54 : (void)tilocPtr;
55 :
56 0 : Int finitePointingOffsets_int = (finitePointingOffsets?1:0),
57 0 : psfOnly_int = (psfOnly?1:0);
58 0 : Int cf0=cfShape(0), cf1=cfShape(1), cf2=cfShape(2), cf3=cfShape(3);
59 0 : Int gnx = nx, gny = ny, gnp = nGridPol, gnc=nGridChan;
60 0 : Int phx=cached_phaseGrad_p.shape()[0], phy=cached_phaseGrad_p.shape()[1];
61 :
62 0 : runTimeG2_p += timer_p.real();
63 :
64 : //
65 : // Call the FORTRAN function with the gridding inner-loops (in synthesis/fortran/faccumulateToGrid.f)
66 : //
67 0 : if (isGridSinglePrecision)
68 : {
69 : // Following type cast is so that this code compiles when
70 : // embedded (via #include) in the templated method
71 : // AWVisResampler::DataToGridImpl_p(). Without this type cast,
72 : // a compile-time error occurs (because this code gets embedded
73 : // in a templated function where the type of gridStore variable
74 : // is templated).
75 0 : Complex *Complex_gridStore=(Complex *)gridStore;
76 0 : faccumulatetogrid_(Complex_gridStore,
77 : convFuncV,
78 : &nvalue,
79 : &dataWVal,
80 : supportPtr,samplingPtr,offPtr, convOriginPtr,
81 : cfShapePtr,locPtr,igrdposPtr,
82 : &sinDPA, &cosDPA,
83 : &finitePointingOffsets_int,
84 : &psfOnly_int,
85 : &norm, phaseGradPtr,
86 : &gnx, &gny, &gnp, &gnc,
87 : &cf0, &cf1, &cf2, &cf3,
88 : &phx, &phy);
89 : // if (fpclassify(abs(norm)) == FP_NAN)
90 : // {
91 : // cerr << "N NAN: " << nvalue << " " << support << " " << sampling << " " << off << " " << convOrigin << " " << loc << " " << igrdpos << " " << cfShape << endl;
92 : // throw(AipsError("NAN DETECTED IN NORM"));
93 : // }
94 : // if (fpclassify(vbs.imagingWeight_p(ichan, irow)) == FP_NAN)
95 : // {
96 : // cerr << "WT NAN: " << nvalue << " " << support << " " << sampling << " " << off << " " << convOrigin << " " << loc << " " << igrdpos << " " << cfShape << endl;
97 : // throw(AipsError("NAN DETECTED IN WT"));
98 : // }
99 : }
100 : else
101 : {
102 0 : DComplex *DComplex_gridStore=(DComplex *)gridStore;
103 0 : dfaccumulatetogrid_(DComplex_gridStore,
104 : convFuncV,
105 : &nvalue,
106 : &dataWVal,
107 : supportPtr,samplingPtr,offPtr, convOriginPtr,
108 : cfShapePtr,locPtr,igrdposPtr,
109 : &sinDPA, &cosDPA,
110 : &finitePointingOffsets_int,
111 : &psfOnly_int,
112 : &norm, phaseGradPtr,
113 : &gnx, &gny, &gnp, &gnc,
114 : &cf0, &cf1, &cf2, &cf3,
115 : &phx, &phy);
116 : // if (fpclassify(abs(norm)) == FP_NAN)
117 : // {
118 : // cerr << "dN NAN: " << getpid() << " " << nvalue << " " << supportPtr[0] << " " << sampling << " " << off << " " << convOrigin << " " << loc << " " << igrdpos << " " << cfShapePtr[0] << endl;
119 : // throw(AipsError("NAN DETECTED IN NORM"));
120 : // }
121 : // if (fpclassify(vbs.imagingWeight_p(ichan, irow)) == FP_NAN)
122 : // {
123 : // cerr << "dWT NAN: " << nvalue << " " << support << " " << sampling << " " << off << " " << convOrigin << " " << loc << " " << igrdpos << " " << cfShape << endl;
124 : // throw(AipsError("NAN DETECTED IN WT"));
125 : // }
126 : }
127 : }
|