/* * Copyright (C) 1998 by Southwest Research Institute (SwRI) * * All rights reserved under U.S. Copyright Law and International Conventions. * * The development of this Software was supported by contracts NAG5-3148, * NAG5-6855, NAS8-36840, NAG5-2323, and NAG5-7043 issued on behalf of * the United States Government by its National Aeronautics and Space * Administration. Southwest Research Institute grants to the Government, * and others acting on its behalf, a paid-up nonexclusive, irrevocable, * worldwide license to reproduce, prepare derivative works, and perform * publicly and display publicly, by or on behalf of the Government. * Other than those rights granted to the United States Government, no part * of this Software may be reproduced in any form or by any means, electronic * or mechanical, including photocopying, without permission in writing from * Southwest Research Institute. All inquiries should be addressed to: * * Director of Contracts * Southwest Research Institute * P. O. Drawer 28510 * San Antonio, Texas 78228-0510 * * * Use of this Software is governed by the terms of the end user license * agreement, if any, which accompanies or is included with the Software * (the "License Agreement"). An end user will be unable to install any * Software that is accompanied by or includes a License Agreement, unless * the end user first agrees to the terms of the License Agreement. Except * as set forth in the applicable License Agreement, any further copying, * reproduction or distribution of this Software is expressly prohibited. * Installation assistance, product support and maintenance, if any, of the * Software is available from SwRI and/or the Third Party Providers, as the * case may be. * * Disclaimer of Warranty * * SOFTWARE IS WARRANTED, IF AT ALL, IN ACCORDANCE WITH THESE TERMS OF THE * LICENSE AGREEMENT. UNLESS OTHERWISE EXPLICITLY STATED, THIS SOFTWARE IS * PROVIDED "AS IS", IS EXPERIMENTAL, AND IS FOR NON-COMMERCIAL USE ONLY, * AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR * PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT * SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID. * * Limitation of Liability * * SwRI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED AS A RESULT OF USING, * MODIFYING, CONTRIBUTING, COPYING, DISTRIBUTING, OR DOWNLOADING THIS * SOFTWARE. IN NO EVENT SHALL SwRI BE LIABLE FOR ANY INDIRECT, PUNITIVE, * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGE (INCLUDING LOSS OF BUSINESS, * REVENUE, PROFITS, USE, DATA OR OTHER ECONOMIC ADVANTAGE) HOWEVER IT ARISES, * WHETHER FOR BREACH OF IN TORT, EVEN IF SwRI HAS BEEN PREVIOUSLY ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. YOU HAVE SOLE RESPONSIBILITY FOR ADEQUATE * PROTECTION AND BACKUP OF DATA AND/OR EQUIPMENT USED IN CONNECTION WITH THE * SOFTWARE AND WILL NOT MAKE A CLAIM AGAINST SwRI FOR LOST DATA, RE-RUN TIME, * INACCURATE OUTPUT, WORK DELAYS OR LOST PROFITS RESULTING FROM THE USE OF * THIS SOFTWARE. YOU AGREE TO HOLD SwRI HARMLESS FROM, AND YOU COVENANT NOT * TO SUE SwRI FOR, ANY CLAIMS BASED ON USING THE SOFTWARE. * * Local Laws: Export Control * * You acknowledge and agree this Software is subject to the U.S. Export * Administration Laws and Regulations. Diversion of such Software contrary * to U.S. law is prohibited. You agree that none of the Software, nor any * direct product therefrom, is being or will be acquired for, shipped, * transferred, or reexported, directly or indirectly, to proscribed or * embargoed countries or their nationals, nor be used for nuclear activities, * chemical biological weapons, or missile projects unless authorized by U.S. * Government. Proscribed countries are set forth in the U.S. Export * Administration Regulations. Countries subject to U.S embargo are: Cuba, * Iran, Iraq, Libya, North Korea, Syria, and the Sudan. This list is subject * to change without further notice from SwRI, and you must comply with the * list as it exists in fact. You certify that you are not on the U.S. * Department of Commerce's Denied Persons List or affiliated lists or on the * U.S. Department of Treasury's Specially Designated Nationals List. You agree * to comply strictly with all U.S. export laws and assume sole responsibilities * for obtaining licenses to export or reexport as may be required. * * General * * These Terms represent the entire understanding relating to the use of the * Software and prevail over any prior or contemporaneous, conflicting or * additional, communications. SwRI can revise these Terms at any time * without notice by updating this posting. * * Trademarks * * The SwRI logo is a trademark of SwRI in the United States and other countries. * */ #ident "@(#) trans_all.c 1.9 05/08/19 SwRI" #include "user_defs.h" #include "gen_defs.h" #include "libtrec_idfs.h" /******************************************************************************* * * * IR_TRANSFER_ALL_DISC SUBROUTINE * * * * DESCRIPTION * * This routine is called to transfer discontinuous data from temporary * * data matrices into the designated buffer for ALL sensors that were * * processed. This module is enacted by the module SWEEP_DISCONTINUOUS_DATA * * since only a single buffer is accumulated for the sample-averaged data. * * This module is also enacted whenever an LOS status is returned to the * * FILL_DISCONTINUOUS_DATA module. When this status is received, the current * * partial working buffer for all sensors that have been processed is * * terminated. Only one buffer can be a "working" buffer at any given time. * * * * INPUT VARIABLES * * SDDAS_CHAR buf_num the buffer of interest * * * * USAGE * * ir_transfer_all_disc (buf_num) * * * * NECESSARY SUBPROGRAMS * * ir_transfer_pps_disc () transfers discontinous data to the buffer * * specified using PPS steps as indexes into * * the bins * * ir_transfer_point_disc () transfers discontinuous data to the buffer * * specified using the center sweep values to * * find the bin * * ir_transfer_band_disc () transfers discontinuous data to the buffer * * specified using sweep bands to find the * * bin(s) covered by the sample * * * * EXTERNAL VARIABLES * * struct general_info structure that holds information concerning * * ginfo the experiment that is being processed * * * * INTERNAL VARIABLES * * struct experiment_info a pointer to the structure that holds * * *ex specific experiment information * * struct fill_data *fptr pointer to the fill_data structure being * * processed * * struct fill_discontinuous pointer to the fill_discontinuous structure * * *disc_ptr being processed * * struct bin_info *bptr a pointer to the structure holding sweep * * binning information * * struct in_fill *mptr pointer to data level combination being * * processed * * struct in_fill *mptr_end loop termination variable * * struct fill_sensor *sptr pointer to fill_sensor structure being * * processed * * register SDDAS_SHORT i looping variable * * register SDDAS_CHAR *c1 pointer to the sensor usage flags * * register SDDAS_CHAR *c_end loop termination variable * * SDDAS_FLOAT *dptr pointer to the discontinuous temporary data * * matrix * * SDDAS_FLOAT *tfrac pointer to the normalization factors for * * the discontinuous temporary data matrix * * SDDAS_FLOAT *last_data pointer to the last_data array for the * * discontinuous data * * SDDAS_FLOAT *ret_data pointer to the data array for the buffer * * of interest * * SDDAS_FLOAT *ret_frac pointer to the normalization factors for * * the buffer of interest * * SDDAS_FLOAT *base_data pointer to BUFFER 0 for this sensor * * SDDAS_FLOAT *base_frac pointer to BUFFER 0 normalization factors * * for this sensor * * SDDAS_LONG offset, offset_disc indexes to get to data set of interest * * SDDAS_SHORT sensor the sensor being processed * * SDDAS_SHORT index indexing variable used to access correct * * sensor variables * * SDDAS_SHORT num_buffers number of buffers returned calling module * * SDDAS_SHORT num_disc the number of elements in the discontinuous * * data matrix * * SDDAS_SHORT num_buf number of bins for the buffer of interest * * SDDAS_CHAR *bin_stat pointer to the bin status array for the * * discontinuous temporary data matrix * * SDDAS_CHAR *cross_bound pointer to the boundary crossing flags * * SDDAS_CHAR *ret_stat pointer to the bin status array for the * * buffer of interest * * SDDAS_CHAR *base_bin pointer to BUFFER 0 bin status array for * * this sensor * * * * SUBSYSTEM * * Display Level * * * ******************************************************************************/ void ir_transfer_all_disc (SDDAS_CHAR buf_num) { extern struct general_info ginfo; struct experiment_info *ex; struct fill_data *fptr; struct fill_discontinuous *disc_ptr; struct bin_info *bptr; struct in_fill *mptr, *mptr_end; struct fill_sensor *sptr; register SDDAS_SHORT i; register SDDAS_CHAR *c1, *c_end; SDDAS_FLOAT *dptr, *tfrac, *last_data, *ret_data, *ret_frac, *base_data; SDDAS_FLOAT *base_frac; SDDAS_LONG offset, offset_disc; SDDAS_SHORT sensor, index, num_buffers, num_disc, num_buf; SDDAS_CHAR *bin_stat, *cross_bound, *ret_stat, *base_bin; /************************************************************************/ /* Loop over all the sensors that are returned in order to transfer */ /* the discontinuous data to the buffer of interest. */ /************************************************************************/ ex = ginfo.expt; bptr = ex->bin_ptr; fptr = ex->fill_arrays; disc_ptr = fptr->fill_disc; /************************************************************************/ /* There is no buffer status array for SWEEP_DISCONTINUOUS_DATA, but */ /* there is for FILL_DISCONTINUOUS_DATA. */ /************************************************************************/ num_buffers = (fptr->buf_stat == NO_MEMORY) ? 1 : NUM_BUFFERS; for (i = 0; i < fptr->sensors_used; ++i) { /************************************************************************/ /* Sensor number not specified. */ /************************************************************************/ if (*(fptr->sensors + i) == -1) continue; /************************************************************************/ /* Determine the index value for the sensor in question. */ /************************************************************************/ c1 = ex->sensors_needed; c_end = c1 + *(fptr->sensors + i); for (index = 0; c1 < c_end;) index += *c1++; sptr = ex->fill_sen_ptr + *(fptr->ind_fill_sen + index); sensor = sptr->sensor_num; /**********************************************************************/ /* Set up pointers to the discontinuous data. */ /**********************************************************************/ offset = *(fptr->num_units + index) * ex->swp_len; dptr = disc_ptr->tot_data + offset; tfrac = disc_ptr->tot_frac + offset; bin_stat = disc_ptr->bin_stat + offset; last_data = disc_ptr->last_data + offset; cross_bound = disc_ptr->cross_boundary + offset; /************************************************************************/ /* Set the data pointer to the beginning of the first buffer (buffer 0)*/ /* for this sensor. */ /************************************************************************/ offset = num_buffers * *(fptr->num_units + index) * bptr->num_bins; base_data = fptr->data + offset; base_frac = fptr->tot_frac + offset; base_bin = fptr->bin_stat + offset; /**********************************************************************/ /* Set up pointers to the buffer of interest. Buf_num should always */ /* be zero for SWEEP_DISCONTINUOUS_DATA (in essence, no offset). */ /**********************************************************************/ offset = buf_num * sptr->num_units * bptr->num_bins; ret_data = base_data + offset; ret_frac = base_frac + offset; ret_stat = base_bin + offset; /**********************************************************************/ /* Transfer the data to the buffer of interest, one unit at a time. */ /**********************************************************************/ offset = 0; offset_disc = 0; mptr = sptr->min_max_app; mptr_end = mptr + sptr->num_units; if (bptr->swp_type == FIXED_SWEEP) { for (; mptr < mptr_end; ++mptr, offset += bptr->num_bins, offset_disc += ex->swp_len) ir_transfer_pps_disc (offset_disc, dptr, tfrac, bin_stat, last_data, cross_bound, offset, ret_data, ret_frac, ret_stat, bptr->num_bins); } else { if (bptr->input_fmt == POINT_STORAGE) { num_disc = ex->swp_len; num_buf = bptr->num_bins; for (; mptr < mptr_end; ++mptr, offset += bptr->num_bins, offset_disc += ex->swp_len) ir_transfer_point_disc (sensor, offset_disc, dptr, tfrac, bin_stat, last_data, cross_bound, offset, ret_data, ret_frac, ret_stat, num_disc, num_buf); } else { num_disc = ex->swp_len; num_buf = bptr->num_bins; for (; mptr < mptr_end; ++mptr, offset += bptr->num_bins, offset_disc += ex->swp_len) ir_transfer_band_disc (sensor, offset_disc, dptr, tfrac, bin_stat, last_data, cross_bound, offset, ret_data, ret_frac, ret_stat, num_disc, num_buf); } } } }