Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
ptwXY_unitaryOperators.c
Go to the documentation of this file.
1/*
2# <<BEGIN-copyright>>
3# Copyright 2019, Lawrence Livermore National Security, LLC.
4# This file is part of the gidiplus package (https://github.com/LLNL/gidiplus).
5# gidiplus is licensed under the MIT license (see https://opensource.org/licenses/MIT).
6# SPDX-License-Identifier: MIT
7# <<END-copyright>>
8*/
9
10#include <math.h>
11#include <float.h>
12
13#include "ptwXY.h"
14
15/*
16************************************************************
17*/
19
20 int64_t i, nonOverflowLength;
21 ptwXYPoint *p;
22 ptwXYOverflowPoint *o, *overflowHeader = &(ptwXY->overflowHeader);
23
24 if( ( nonOverflowLength = ptwXY_getNonOverflowLength( smr, ptwXY ) ) < 0 ) {
26 return( ptwXY->status );
27 }
28
29 for( i = 0, p = ptwXY->points; i < nonOverflowLength; i++, p++ ) p->y = fabs( p->y );
30 for( o = overflowHeader->next; o != overflowHeader; o = o->next ) o->point.y = fabs( o->point.y );
31 return( ptwXY->status );
32}
33/*
34************************************************************
35*/
37
38 int64_t i, nonOverflowLength;
39 ptwXYPoint *p;
40 ptwXYOverflowPoint *o, *overflowHeader = &(ptwXY->overflowHeader);
41
42 if( ( nonOverflowLength = ptwXY_getNonOverflowLength( smr, ptwXY ) ) < 0 ) {
44 return( ptwXY->status );
45 }
46
50 "Negation of non-linear y-interpolation not allowed: interpolation = '%s'.",
51 ptwXY->interpolationString );
53 }
54
55 for( i = 0, p = ptwXY->points; i < nonOverflowLength; i++, p++ ) p->y = -p->y;
56 for( o = overflowHeader->next; o != overflowHeader; o = o->next ) o->point.y = -o->point.y;
57 return( ptwXY->status );
58}
@ nfu_unsupportedInterpolation
@ nfu_Error
enum nfu_status_e nfu_status
int nfu_SMR_libraryID
int64_t ptwXY_getNonOverflowLength(statusMessageReporting *smr, ptwXYPoints const *ptwXY)
Definition ptwXY_core.c:805
struct ptwXYOverflowPoint_s ptwXYOverflowPoint
@ ptwXY_interpolationFlat
Definition ptwXY.h:38
@ ptwXY_interpolationLinLog
Definition ptwXY.h:37
@ ptwXY_interpolationLinLin
Definition ptwXY.h:37
struct ptwXYPoints_s ptwXYPoints
struct ptwXYPoint_s ptwXYPoint
nfu_status ptwXY_neg(statusMessageReporting *smr, ptwXYPoints *ptwXY)
nfu_status ptwXY_abs(statusMessageReporting *smr, ptwXYPoints *ptwXY)
#define smr_setReportError2(smr, libraryID, code, fmt,...)
#define smr_setReportError2p(smr, libraryID, code, fmt)
struct ptwXYOverflowPoint_s * next
Definition ptwXY.h:73
ptwXYPoint point
Definition ptwXY.h:75
double y
Definition ptwXY.h:64
ptwXYOverflowPoint overflowHeader
Definition ptwXY.h:92
ptwXYPoint * points
Definition ptwXY.h:93
ptwXY_interpolation interpolation
Definition ptwXY.h:81
nfu_status status
Definition ptwXY.h:80
char const * interpolationString
Definition ptwXY.h:82