Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
MCGIDI_functions.cc
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 <typeinfo>
11
12#include "MCGIDI.hpp"
13
14namespace MCGIDI {
15
16namespace Functions {
17
18/*
19============================================================
20======================= FunctionBase =====================
21============================================================
22*/
24 m_dimension( 0 ),
25 m_domainMin( 0.0 ),
26 m_domainMax( 0.0 ),
27 m_interpolation( Interpolation::LINLIN ),
28 m_outerDomainValue( 0.0 ) {
29
30}
31/*
32============================================================
33*/
35 m_dimension( a_function.dimension( ) ),
36 m_domainMin( a_function.domainMin( ) ),
37 m_domainMax( a_function.domainMax( ) ),
38 m_interpolation( GIDI2MCGIDI_interpolation( a_function.interpolation( ) ) ),
39 m_outerDomainValue( a_function.outerDomainValue( ) ) {
40
41}
42/*
43============================================================
44*/
45LUPI_HOST_DEVICE FunctionBase::FunctionBase( int a_dimension, double a_domainMin, double a_domainMax, Interpolation a_interpolation, double a_outerDomainValue ) :
46 m_dimension( a_dimension ),
47 m_domainMin( a_domainMin ),
48 m_domainMax( a_domainMax ),
49 m_interpolation( a_interpolation ),
50 m_outerDomainValue( a_outerDomainValue ) {
51
52}
53
54/* *********************************************************************************************************//**
55 ***********************************************************************************************************/
56
60
61/* *********************************************************************************************************//**
62 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
63 * bytes, pack *this* or unpack *this* depending on *a_mode*.
64 *
65 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
66 * @param a_mode [in] Specifies the action of this method.
67 ***********************************************************************************************************/
68
70
71 DATA_MEMBER_INT( m_dimension, a_buffer, a_mode );
72 DATA_MEMBER_DOUBLE( m_domainMin, a_buffer, a_mode );
73 DATA_MEMBER_DOUBLE( m_domainMax, a_buffer, a_mode );
74
75 int interpolation = 0;
76 if( a_mode != LUPI::DataBuffer::Mode::Unpack ) {
77 switch( m_interpolation ) {
79 break;
81 interpolation = 1;
82 break;
84 interpolation = 2;
85 break;
87 interpolation = 3;
88 break;
90 interpolation = 4;
91 break;
93 interpolation = 5;
94 break;
95 }
96 }
97 DATA_MEMBER_INT( interpolation, a_buffer, a_mode );
98 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
99 switch( interpolation ) {
100 case 0 :
101 m_interpolation = Interpolation::FLAT;
102 break;
103 case 1 :
104 m_interpolation = Interpolation::LINLIN;
105 break;
106 case 2 :
107 m_interpolation = Interpolation::LINLOG;
108 break;
109 case 3 :
110 m_interpolation = Interpolation::LOGLIN;
111 break;
112 case 4 :
113 m_interpolation = Interpolation::LOGLOG;
114 break;
115 case 5 :
116 m_interpolation = Interpolation::OTHER;
117 break;
118 }
119 }
120
121 DATA_MEMBER_DOUBLE( m_outerDomainValue, a_buffer, a_mode );
122}
123
124/*
125============================================================
126========================= Function1d =======================
127============================================================
128*/
133/*
134============================================================
135*/
136LUPI_HOST_DEVICE Function1d::Function1d( double a_domainMin, double a_domainMax, Interpolation a_interpolation, double a_outerDomainValue ) :
137 FunctionBase( 1, a_domainMin, a_domainMax, a_interpolation, a_outerDomainValue ),
139
140}
141
142/* *********************************************************************************************************//**
143 ***********************************************************************************************************/
144
148
149/* *********************************************************************************************************//**
150 * Returns a String representation of the **Function1d** type of *this*.
151 *
152 * @return A String instance.
153 ***********************************************************************************************************/
154
156
157 String typeStr( "Function1d::" );
158
159 switch( m_type ) {
161 typeStr += "none";
162 break;
164 typeStr += "constant";
165 break;
167 typeStr += "XYs";
168 break;
170 typeStr += "polyomial";
171 break;
173 typeStr += "gridded";
174 break;
176 typeStr += "regions";
177 break;
179 typeStr += "branching";
180 break;
182 typeStr += "TerrellFissionNeutronMultiplicityModel";
183 break;
184 }
185
186 return( typeStr );
187}
188
189/* *********************************************************************************************************//**
190 * Returns the value of the function at *a_x1*.
191 *
192 * @param a_x1 [in] The x-value to evaluate the function at.
193 *
194 * @return The value of the function at *a_x1*.
195 ***********************************************************************************************************/
196
197LUPI_HOST_DEVICE double Function1d::evaluate( double a_x1 ) const {
198
199 double value = 0.0;
200
201 switch( type( ) ) {
203 break;
205 value = static_cast<Constant1d const *>( this )->evaluate( a_x1 );
206 break;
208 value = static_cast<XYs1d const *>( this )->evaluate( a_x1 );
209 break;
211 value = static_cast<Polynomial1d const *>( this )->evaluate( a_x1 );
212 break;
214 value = static_cast<Gridded1d const *>( this )->evaluate( a_x1 );
215 break;
217 value = static_cast<Regions1d const *>( this )->evaluate( a_x1 );
218 break;
220 value = static_cast<Branching1d const *>( this )->evaluate( a_x1 );
221 break;
223 value = static_cast<TerrellFissionNeutronMultiplicityModel const *>( this )->evaluate( a_x1 );
224 break;
225 }
226
227 return( value );
228}
229
230/* *********************************************************************************************************//**
231 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
232 * bytes, pack *this* or unpack *this* depending on *a_mode*.
233 *
234 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
235 * @param a_mode [in] Specifies the action of this method.
236 ***********************************************************************************************************/
237
239
240 FunctionBase::serialize( a_buffer, a_mode );
241
242 int type = 0;
243 if( a_mode != LUPI::DataBuffer::Mode::Unpack ) {
244 switch( m_type ) {
246 break;
248 type = 1;
249 break;
251 type = 2;
252 break;
254 type = 3;
255 break;
257 type = 4;
258 break;
260 type = 5;
261 break;
263 type = 6;
264 break;
266 type = 7;
267 break;
268 }
269 }
270 DATA_MEMBER_INT( type, a_buffer, a_mode );
271 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
272 switch( type ) {
273 case 0 :
275 break;
276 case 1 :
278 break;
279 case 2 :
281 break;
282 case 3 :
284 break;
285 case 4 :
287 break;
288 case 5 :
290 break;
291 case 6 :
293 break;
294 case 7 :
296 break;
297 }
298 }
299}
300
301/* *********************************************************************************************************//**
302 * Returns the value of the function at *a_x1*.
303 *
304 * @param a_x1 [in] The x-value to evaluate the function at.
305 *
306 * @return The value of the function at *a_x1*.
307 ***********************************************************************************************************/
308
309LUPI_HOST_DEVICE double Function1d_d1::evaluate( double a_x1 ) const {
310
311 double value = 0.0;
312
313 switch( type( ) ) {
315 break;
317 value = static_cast<Constant1d const *>( this )->evaluate( a_x1 );
318 break;
320 value = static_cast<XYs1d const *>( this )->evaluate( a_x1 );
321 break;
323 value = static_cast<Polynomial1d const *>( this )->evaluate( a_x1 );
324 break;
326 value = static_cast<Gridded1d const *>( this )->evaluate( a_x1 );
327 break;
329 value = static_cast<Regions1d const *>( this )->evaluate( a_x1 );
330 break;
332 value = static_cast<Branching1d const *>( this )->evaluate( a_x1 );
333 break;
334 default:
335 String message( "Function1d_d1::evaluate: Unsupported Function1d_d1 " + typeString( ) );
336 LUPI_THROW( message.c_str( ) );
337 }
338
339 return( value );
340}
341
342/* *********************************************************************************************************//**
343 * Returns the value of the function at *a_x1*.
344 *
345 * @param a_x1 [in] The x-value to evaluate the function at.
346 *
347 * @return The value of the function at *a_x1*.
348 ***********************************************************************************************************/
349
350LUPI_HOST_DEVICE double Function1d_d2::evaluate( double a_x1 ) const {
351
352 double value = 0.0;
353
354 switch( type( ) ) {
356 break;
358 value = static_cast<Constant1d const *>( this )->evaluate( a_x1 );
359 break;
361 value = static_cast<XYs1d const *>( this )->evaluate( a_x1 );
362 break;
364 value = static_cast<Polynomial1d const *>( this )->evaluate( a_x1 );
365 break;
367 value = static_cast<Gridded1d const *>( this )->evaluate( a_x1 );
368 break;
370 value = static_cast<Branching1d const *>( this )->evaluate( a_x1 );
371 break;
372 default: // This should never happend.
373 String message( "Function1d_d2::evaluate: Unsupported Function1d_d2 " + typeString( ) );
374 LUPI_THROW( message.c_str( ) );
375 }
376
377 return( value );
378}
379
380/*
381============================================================
382======================== Constant1d ========================
383============================================================
384*/
390/*
391============================================================
392*/
393LUPI_HOST_DEVICE Constant1d::Constant1d( double a_domainMin, double a_domainMax, double a_value, double a_outerDomainValue ) :
394 Function1d_d2( a_domainMin, a_domainMax, Interpolation::FLAT, a_outerDomainValue ),
395 m_value( a_value ) {
396
398}
399/*
400============================================================
401*/
403 Function1d_d2( a_form1d.domainMin( ), a_form1d.domainMax( ), Interpolation::FLAT, a_form1d.outerDomainValue( ) ),
404 m_value( a_form1d.value( ) ) {
405
407}
408
409/* *********************************************************************************************************//**
410 ***********************************************************************************************************/
411
415
416/* *********************************************************************************************************//**
417 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
418 * bytes, pack *this* or unpack *this* depending on *a_mode*.
419 *
420 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
421 * @param a_mode [in] Specifies the action of this method.
422 ***********************************************************************************************************/
423
425
426 Function1d::serialize( a_buffer, a_mode );
427 DATA_MEMBER_DOUBLE( m_value, a_buffer, a_mode );
428}
429
430/*
431============================================================
432=========================== XYs1d ==========================
433============================================================
434*/
436 m_Xs( ),
437 m_Ys( ) {
438
440}
441/*
442============================================================
443*/
444LUPI_HOST XYs1d::XYs1d( Interpolation a_interpolation, Vector<double> a_Xs, Vector<double> a_Ys, double a_outerDomainValue ) :
445 Function1d_d2( a_Xs[0], a_Xs.back( ), a_interpolation, a_outerDomainValue ),
446 m_Xs( a_Xs ),
447 m_Ys( a_Ys ) {
448
450}
451/*
452============================================================
453*/
455 Function1d_d2( a_XYs1d.domainMin( ), a_XYs1d.domainMax( ), GIDI2MCGIDI_interpolation( a_XYs1d.interpolation( ) ), a_XYs1d.outerDomainValue( ) ) {
456
458 std::size_t size = a_XYs1d.size( );
459
460 m_Xs.resize( size );
461 m_Ys.resize( size );
462 for( std::size_t i1 = 0; i1 < size; ++i1 ) {
463 std::pair<double, double> xy = a_XYs1d[i1];
464 m_Xs[i1] = xy.first;
465 m_Ys[i1] = xy.second;
466 }
467}
468
469/* *********************************************************************************************************//**
470 ***********************************************************************************************************/
471
475/*
476============================================================
477*/
478LUPI_HOST_DEVICE double XYs1d::evaluate( double a_x1 ) const {
479
480 int intLower = binarySearchVector( a_x1, m_Xs );
481
482 if( intLower < 0 ) {
483 if( intLower == -2 ) return( m_Ys[0] );
484 return( m_Ys.back( ) );
485 }
486 std::size_t lower = static_cast<std::size_t>( intLower );
487
488 double evaluatedValue = 0.0;
489 double y1 = m_Ys[lower];
490
492 evaluatedValue = y1; }
493 else {
494 double x1 = m_Xs[lower];
495 double x2 = m_Xs[lower+1];
496 double y2 = m_Ys[lower+1];
497
499 double fraction = ( x2 - a_x1 ) / ( x2 - x1 );
500 evaluatedValue = fraction * y1 + ( 1 - fraction ) * y2; }
501 else if( interpolation( ) == Interpolation::LINLOG ) {
502 double fraction = log( x2 / a_x1 ) / log( x2 / x1 );
503 evaluatedValue = fraction * y1 + ( 1 - fraction ) * y2; }
504 else if( interpolation( ) == Interpolation::LOGLIN ) {
505 double fraction = ( x2 - a_x1 ) / ( x2 - x1 );
506 evaluatedValue = exp( fraction * log( y1 ) + ( 1 - fraction ) * log( y2 ) ); }
507 else if( interpolation( ) == Interpolation::LOGLOG ) {
508 double fraction = log( x2 / a_x1 ) / log( x2 / x1 );
509 evaluatedValue = exp( fraction * log( y1 ) + ( 1 - fraction ) * log( y2 ) ); }
510 else {
511 LUPI_THROW( "XYs1d::evaluate: unsupport interpolation." );
512 }
513 }
514
515 return( evaluatedValue );
516}
517
518/* *********************************************************************************************************//**
519 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
520 * bytes, pack *this* or unpack *this* depending on *a_mode*.
521 *
522 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
523 * @param a_mode [in] Specifies the action of this method.
524 ***********************************************************************************************************/
525
527
528 Function1d::serialize( a_buffer, a_mode );
529 DATA_MEMBER_VECTOR_DOUBLE( m_Xs, a_buffer, a_mode );
530 DATA_MEMBER_VECTOR_DOUBLE( m_Ys, a_buffer, a_mode );
531}
532
533/*
534============================================================
535======================= Polynomial1d =======================
536============================================================
537*/
539 m_coefficients( ),
540 m_coefficientsReversed( ) {
541
543}
544/*
545============================================================
546*/
547LUPI_HOST Polynomial1d::Polynomial1d( double a_domainMin, double a_domainMax, Vector<double> const &a_coefficients, double a_outerDomainValue ) :
548 Function1d_d2( a_domainMin, a_domainMax, Interpolation::LINLIN, a_outerDomainValue ),
549 m_coefficients( a_coefficients ) {
550
552
553 m_coefficientsReversed.reserve( m_coefficients.size( ) );
554 for( Vector<double>::iterator iter = m_coefficients.begin( ); iter != m_coefficients.end( ); ++iter )
555 m_coefficientsReversed.push_back( *iter );
556}
557/*
558============================================================
559*/
561 Function1d_d2( a_polynomial1d.domainMin( ), a_polynomial1d.domainMax( ), Interpolation::LINLIN, a_polynomial1d.outerDomainValue( ) ) {
562
564
565 m_coefficients = a_polynomial1d.coefficients( );
566 m_coefficientsReversed.reserve( m_coefficients.size( ) );
567 for( Vector<double>::iterator iter = m_coefficients.begin( ); iter != m_coefficients.end( ); ++iter )
568 m_coefficientsReversed.push_back( *iter );
569}
570
571/* *********************************************************************************************************//**
572 ***********************************************************************************************************/
573
577/*
578============================================================
579*/
580LUPI_HOST_DEVICE double Polynomial1d::evaluate( double a_x1 ) const {
581
582 double d_value = 0;
583
584 for( Vector<double>::const_iterator iter = m_coefficientsReversed.begin( ); iter != m_coefficientsReversed.end( ); ++iter ) {
585 d_value = *iter + d_value * a_x1;
586 }
587
588 return( d_value );
589}
590
591/* *********************************************************************************************************//**
592 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
593 * bytes, pack *this* or unpack *this* depending on *a_mode*.
594 *
595 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
596 * @param a_mode [in] Specifies the action of this method.
597 ***********************************************************************************************************/
598
600
601 Function1d::serialize( a_buffer, a_mode );
602 DATA_MEMBER_VECTOR_DOUBLE( m_coefficients, a_buffer, a_mode );
603 DATA_MEMBER_VECTOR_DOUBLE( m_coefficientsReversed, a_buffer, a_mode );
604}
605
606/*
607============================================================
608========================= Gridded1d ========================
609============================================================
610*/
612 m_grid( ),
613 m_data( ) {
614
616}
617/*
618============================================================
619*/
621 Function1d_d2( a_gridded1d.domainMin( ), a_gridded1d.domainMax( ), Interpolation::FLAT, a_gridded1d.outerDomainValue( ) ) {
622
624
625 GIDI::Vector const &grid = a_gridded1d.grid( );
626 m_grid.resize( grid.size( ) );
627 for( std::size_t i1 = 0; i1 < grid.size( ); ++i1 ) m_grid[i1] = grid[i1];
628
629 GIDI::Vector const &data = a_gridded1d.data( );
630 m_data.resize( data.size( ) );
631 for( std::size_t i1 = 0; i1 < data.size( ); ++i1 ) m_data[i1] = data[i1];
632}
633
634/* *********************************************************************************************************//**
635 ***********************************************************************************************************/
636
640/*
641============================================================
642*/
643LUPI_HOST_DEVICE double Gridded1d::evaluate( double a_x1 ) const {
644
645 return( m_data[(std::size_t) binarySearchVector( a_x1, m_grid, true )] );
646}
647
648/* *********************************************************************************************************//**
649 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
650 * bytes, pack *this* or unpack *this* depending on *a_mode*.
651 *
652 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
653 * @param a_mode [in] Specifies the action of this method.
654 ***********************************************************************************************************/
655
657
658 Function1d::serialize( a_buffer, a_mode );
659 DATA_MEMBER_VECTOR_DOUBLE( m_grid, a_buffer, a_mode );
660 DATA_MEMBER_VECTOR_DOUBLE( m_data, a_buffer, a_mode );
661}
662
663/*
664============================================================
665========================= Regions1d ========================
666============================================================
667*/
669 m_Xs( ),
670 m_functions1d( ) {
671
673}
674/*
675============================================================
676*/
678 Function1d_d1( a_regions1d.domainMin( ), a_regions1d.domainMax( ), Interpolation::LINLIN, a_regions1d.outerDomainValue( ) ) {
679
681
682 m_Xs.reserve( a_regions1d.size( ) + 1 );
683 m_functions1d.reserve( a_regions1d.size( ) );
684 for( std::size_t i1 = 0; i1 < a_regions1d.size( ); ++i1 ) append( parseFunction1d_d2( a_regions1d[i1] ) );
685}
686
687/* *********************************************************************************************************//**
688 ***********************************************************************************************************/
689
691
692 for( std::size_t i1 = 0; i1 < m_functions1d.size( ); ++i1 ) delete m_functions1d[i1];
693}
694/*
695============================================================
696*/
698
699 if( m_functions1d.size( ) == 0 ) m_Xs.push_back( a_function1d->domainMin( ) );
700 m_Xs.push_back( a_function1d->domainMax( ) );
701
702 m_functions1d.push_back( a_function1d );
703}
704/*
705============================================================
706*/
707LUPI_HOST_DEVICE double Regions1d::evaluate( double a_x1 ) const {
708
709 int intLower = binarySearchVector( a_x1, m_Xs );
710
711 if( intLower < 0 ) {
712 if( intLower == -1 ) { // a_x1 > last value of m_Xs.
713 return( m_functions1d.back( )->evaluate( a_x1 ) );
714 }
715 intLower = 0; // a_x1 < last value of m_Xs.
716 }
717
718 std::size_t lower = static_cast<std::size_t>( intLower );
719
720 return( m_functions1d[lower]->evaluate( a_x1 ) );
721}
722
723/* *********************************************************************************************************//**
724 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
725 * bytes, pack *this* or unpack *this* depending on *a_mode*.
726 *
727 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
728 * @param a_mode [in] Specifies the action of this method.
729 ***********************************************************************************************************/
730
732
733 Function1d::serialize( a_buffer, a_mode );
734 DATA_MEMBER_VECTOR_DOUBLE( m_Xs, a_buffer, a_mode );
735
736 std::size_t vectorSize = m_functions1d.size( );
737 int vectorSizeInt = (int) vectorSize;
738 DATA_MEMBER_INT( vectorSizeInt, a_buffer, a_mode );
739 vectorSize = (std::size_t) vectorSizeInt;
740 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) m_functions1d.resize( vectorSize, &a_buffer.m_placement );
741 if( a_mode == LUPI::DataBuffer::Mode::Memory ) a_buffer.m_placement += m_functions1d.internalSize();
742 for( std::size_t vectorIndex = 0; vectorIndex < vectorSize; ++vectorIndex ) {
743 m_functions1d[vectorIndex] = serializeFunction1d_d2( a_buffer, a_mode, m_functions1d[vectorIndex] );
744 }
745}
746
747/*
748============================================================
749======================== Branching1d =======================
750============================================================
751*/
755
756/* *********************************************************************************************************//**
757 * Function that parses a node one-d function node. Called from a Suite::parse instance.
758 *
759 * @param a_setupInfo [in] Information create my the Protare constructor to help in parsing.
760 * @param a_form1d [in] The GIDI::Functions::Branching1d instance whose data is to be used to construct *this*.
761 *
762 * @return The parsed and constructed resonanceBackground region instance.
763 ***********************************************************************************************************/
764
765/*
766============================================================
767*/
769 Function1d_d2( a_form1d.domainMin( ), a_form1d.domainMax( ), Interpolation::FLAT, 0.0 ),
770 m_initialStateIndex( -1 ) {
771
773
774 std::map<std::string,int>::iterator iter = a_setupInfo.m_stateNamesToIndices.find( a_form1d.initialState( ) );
775 if( iter == a_setupInfo.m_stateNamesToIndices.end( ) ) {
776 std::string message( "Branching1d: initial state not found: pid = '" + a_form1d.initialState( ) + "'." );
777 throw std::runtime_error( message.c_str( ) );
778 }
779 m_initialStateIndex = iter->second;
780
781 a_setupInfo.m_initialStateIndex = m_initialStateIndex;
782}
783
784/* *********************************************************************************************************//**
785 ***********************************************************************************************************/
786
790/*
791============================================================
792*/
793LUPI_HOST_DEVICE double Branching1d::evaluate( LUPI_maybeUnused double a_x1 ) const {
794
795 return( 0.0 ); // Returns 0 as needed by Product::sampleProducts.
796}
797
798/* *********************************************************************************************************//**
799 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
800 * bytes, pack *this* or unpack *this* depending on *a_mode*.
801 *
802 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
803 * @param a_mode [in] Specifies the action of this method.
804 ***********************************************************************************************************/
805
807
808 Function1d::serialize( a_buffer, a_mode );
809 DATA_MEMBER_INT( m_initialStateIndex, a_buffer, a_mode );
810}
811
812/*
813============================================================
814========== TerrellFissionNeutronMultiplicityModel ==========
815============================================================
816*/
817
824
825/* *********************************************************************************************************//**
826 ***********************************************************************************************************/
827
829 Function1d( a_multiplicity->domainMin( ), a_multiplicity->domainMax( ), a_multiplicity->interpolation( ), a_multiplicity->outerDomainValue( ) ),
830 m_width( a_width ),
831 m_multiplicity( a_multiplicity ) {
832
834 if( a_width < 0.0 ) m_width = 1.079;
835}
836
837/* *********************************************************************************************************//**
838 ***********************************************************************************************************/
839
844
845/* *********************************************************************************************************//**
846 * Evaluated the *m_multiplicity* function at energy *a_energy*.
847 *
848 * @param a_energy [in] The energy of the projectile.
849 *
850 * @return The number of emitted, prompt neutrons.
851 ***********************************************************************************************************/
852
854
855 return( m_multiplicity->evaluate( a_energy ) );
856}
857
858/* *********************************************************************************************************//**
859 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
860 * bytes, pack *this* or unpack *this* depending on *a_mode*.
861 *
862 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
863 * @param a_mode [in] Specifies the action of this method.
864 ***********************************************************************************************************/
865
867
868 Function1d::serialize( a_buffer, a_mode );
869 DATA_MEMBER_DOUBLE( m_width, a_buffer, a_mode );
870
871 m_multiplicity = serializeFunction1d_d1( a_buffer, a_mode, m_multiplicity );
872}
873
874/*
875============================================================
876======================== Function2d ========================
877============================================================
878*/
883/*
884============================================================
885*/
886LUPI_HOST Function2d::Function2d( double a_domainMin, double a_domainMax, Interpolation a_interpolation, double a_outerDomainValue ) :
887 FunctionBase( 2, a_domainMin, a_domainMax, a_interpolation, a_outerDomainValue ),
889
890}
891
892/* *********************************************************************************************************//**
893 ***********************************************************************************************************/
894
898
899/* *********************************************************************************************************//**
900 * Returns a String representation of the **Function2d** type of *this*.
901 *
902 * @return A String instance.
903 ***********************************************************************************************************/
904
906
907 String typeStr( "Function2d::" );
908
909 switch( m_type ) {
911 typeStr += "none";
912 break;
914 typeStr += "XYs";
915 break;
916 }
917
918 return( typeStr );
919}
920
921/* *********************************************************************************************************//**
922 * Returns the value of the function f(x2, x1) at x2 = *a_x2* and x1 = *a_x1*.
923 *
924 * @param a_x2 [in] The x2 value.
925 * @param a_x1 [in] The x1 value.
926 *
927 * @return The value of the function at *a_x1*.
928 ***********************************************************************************************************/
929
930LUPI_HOST_DEVICE double Function2d::evaluate( double a_x2, double a_x1 ) const {
931
932 return( static_cast<XYs2d const *>( this )->evaluate( a_x2, a_x1 ) );
933}
934
935/* *********************************************************************************************************//**
936 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
937 * bytes, pack *this* or unpack *this* depending on *a_mode*.
938 *
939 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
940 * @param a_mode [in] Specifies the action of this method.
941 ***********************************************************************************************************/
942
944
945 FunctionBase::serialize( a_buffer, a_mode );
946
947 int type = 0;
948 if( a_mode != LUPI::DataBuffer::Mode::Unpack ) {
949 switch( m_type ) {
951 break;
953 type = 1;
954 break;
955 }
956 }
957 DATA_MEMBER_INT( type, a_buffer, a_mode );
958 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
959 switch( type ) {
960 case 0 :
962 break;
963 case 1 :
965 break;
966 }
967 }
968}
969
970/*
971============================================================
972========================== XYs2d ===========================
973============================================================
974*/
976 m_Xs( ),
977 m_functions1d( ) {
978
980}
981/*
982============================================================
983*/
985 Function2d( a_XYs2d.domainMin( ), a_XYs2d.domainMax( ), GIDI2MCGIDI_interpolation( a_XYs2d.interpolation( ) ), a_XYs2d.outerDomainValue( ) ),
986 m_Xs( a_XYs2d.Xs( ) ) {
987
989
990 Vector<GIDI::Functions::Function1dForm *> const &function1ds = a_XYs2d.function1ds( );
991 m_functions1d.resize( function1ds.size( ) );
992 for( std::size_t i1 = 0; i1 < function1ds.size( ); ++i1 ) m_functions1d[i1] = parseFunction1d_d1( function1ds[i1] );
993}
994
995/* *********************************************************************************************************//**
996 ***********************************************************************************************************/
997
999
1000 for( std::size_t i1 = 0; i1 < m_functions1d.size( ); ++i1 ) delete m_functions1d[i1];
1001}
1002/*
1003============================================================
1004*/
1005LUPI_HOST_DEVICE double XYs2d::evaluate( double a_x2, double a_x1 ) const {
1006
1007 int intLower = binarySearchVector( a_x2, m_Xs );
1008 double evaluatedValue = 0.0;
1009
1010 if( intLower < 0 ) {
1011 if( intLower == -1 ) { /* X2 > last value of Xs. */
1012 evaluatedValue = m_functions1d.back( )->evaluate( a_x1 ); }
1013 else { /* X2 < first value of Xs. */
1014 evaluatedValue = m_functions1d[0]->evaluate( a_x1 );
1015 } }
1016 else {
1017 std::size_t lower = static_cast<std::size_t>( intLower );
1018 double y1 = m_functions1d[lower]->evaluate( a_x1 );
1019
1021 evaluatedValue = y1; }
1022 else {
1023 double x1 = m_Xs[lower];
1024 double x2 = m_Xs[lower+1];
1025 double y2 = m_functions1d[lower+1]->evaluate( a_x1 );
1026
1028 double fraction = ( x2 - a_x2 ) / ( x2 - x1 );
1029 evaluatedValue = fraction * y1 + ( 1 - fraction ) * y2; }
1030 else if( interpolation( ) == Interpolation::LINLOG ) {
1031 double fraction = log( x2 / a_x2 ) / log( x2 / x1 );
1032 evaluatedValue = fraction * y1 + ( 1 - fraction ) * y2; }
1033 else if( interpolation( ) == Interpolation::LOGLIN ) {
1034 double fraction = ( x2 - a_x2 ) / ( x2 - x1 );
1035 evaluatedValue = exp( fraction * log( y1 ) + ( 1 - fraction ) * log( y2 ) ); }
1036 else if( interpolation( ) == Interpolation::LOGLOG ) {
1037 double fraction = log( x2 / a_x2 ) / log( x2 / x1 );
1038 evaluatedValue = exp( fraction * log( y1 ) + ( 1 - fraction ) * log( y2 ) ); }
1039 else {
1040 LUPI_THROW( "XYs2d::evaluate: unsupport interpolation." );
1041 }
1042 }
1043 }
1044
1045 return( evaluatedValue );
1046}
1047
1048/* *********************************************************************************************************//**
1049 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
1050 * bytes, pack *this* or unpack *this* depending on *a_mode*.
1051 *
1052 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
1053 * @param a_mode [in] Specifies the action of this method.
1054 ***********************************************************************************************************/
1055
1057
1058 Function2d::serialize( a_buffer, a_mode );
1059 DATA_MEMBER_VECTOR_DOUBLE( m_Xs, a_buffer, a_mode );
1060
1061 std::size_t vectorSize = m_functions1d.size( );
1062 int vectorSizeInt = (int) vectorSize;
1063 DATA_MEMBER_INT( vectorSizeInt, a_buffer, a_mode );
1064 vectorSize = (std::size_t) vectorSizeInt;
1065 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) m_functions1d.resize( vectorSize, &a_buffer.m_placement );
1066 if( a_mode == LUPI::DataBuffer::Mode::Memory ) a_buffer.m_placement += m_functions1d.internalSize();
1067 for( std::size_t vectorIndex = 0; vectorIndex < vectorSize; ++vectorIndex ) {
1068 m_functions1d[vectorIndex] = serializeFunction1d_d1( a_buffer, a_mode, m_functions1d[vectorIndex] );
1069 }
1070}
1071
1072/*
1073============================================================
1074========================== others ==========================
1075============================================================
1076*/
1078
1079 auto preProcessingChainEnds = a_setupInfo.m_GIDI_protare.styles( ).preProcessingChainEnds( );
1080 if( preProcessingChainEnds.size( ) != 1 ) throw std::runtime_error( "Functions::parseMultiplicityFunction1d: preProcessingChainEnds != 1." );
1081
1082 std::string const &label = preProcessingChainEnds[0]->label( );
1083 GIDI::Functions::Function1dForm const *form1d = nullptr;
1084 if( a_suite.has( "muCutoff" ) ) { // Special case to handle legacy no-Rutherford processing which set the label to "muCutoff".
1085 form1d = a_suite.get<GIDI::Functions::Function1dForm const>( 0 ); }
1086 else {
1087 form1d = a_suite.getViaLineage<GIDI::Functions::Function1dForm const>( label );
1088 }
1089
1090 if( form1d->type( ) == GIDI::FormType::branching1d ) return( new Branching1d( a_setupInfo, *static_cast<GIDI::Functions::Branching1d const *>( form1d ) ) );
1091 if( form1d->type( ) == GIDI::FormType::unspecified1d ) return( nullptr );
1092
1093 return( parseFunction1d_d1( form1d ) );
1094}
1095
1096/*
1097============================================================
1098*/
1100
1101 GIDI::FormType type = a_form1d->type( );
1102
1103 switch( type ) {
1105 return( new Constant1d( *static_cast<GIDI::Functions::Constant1d const *>( a_form1d ) ) );
1107 return( new XYs1d( *static_cast<GIDI::Functions::XYs1d const *>( a_form1d ) ) );
1109 return( new Polynomial1d( *static_cast<GIDI::Functions::Polynomial1d const *>( a_form1d ) ) );
1111 return( new Gridded1d( *static_cast<GIDI::Functions::Gridded1d const *>( a_form1d ) ) );
1113 return( new Regions1d( *static_cast<GIDI::Functions::Regions1d const *>( a_form1d ) ) );
1115 std::cout << "parseFunction1d_d1: Unsupported Function1d reference1d.";
1116 break;
1117 default : // GIDI::FormTypes Legendre1d, reference1d, xs_pdFormType::cdf1d and resonancesWithBackground1d
1118 throw std::runtime_error( "Functions::parseFunction1d_d1: Unsupported Function1d" );
1119 }
1120
1121 return( nullptr );
1122}
1123
1124/*
1125============================================================
1126*/
1128
1129 GIDI::FormType type = a_form1d->type( );
1130
1131 switch( type ) {
1133 return( new Constant1d( *static_cast<GIDI::Functions::Constant1d const *>( a_form1d ) ) );
1135 return( new XYs1d( *static_cast<GIDI::Functions::XYs1d const *>( a_form1d ) ) );
1137 return( new Polynomial1d( *static_cast<GIDI::Functions::Polynomial1d const *>( a_form1d ) ) );
1139 return( new Gridded1d( *static_cast<GIDI::Functions::Gridded1d const *>( a_form1d ) ) );
1141 std::cout << "Functions::parseFunction1d_d2: Unsupported Function1d reference1d.";
1142 break;
1143 default :
1144 throw std::runtime_error( "Functions::parseFunction1d_d2: Unsupported Function1d" );
1145 }
1146
1147 return( nullptr );
1148}
1149
1150/*
1151============================================================
1152*/
1154
1155 GIDI::FormType type = form2d->type( );
1156
1157 switch( type ) {
1159 return( new XYs2d( *static_cast<GIDI::Functions::XYs2d const *>( form2d ) ) );
1160 default :
1161 throw std::runtime_error( "Functions::parseFunction2d: Unsupported Function2d" );
1162 }
1163
1164 return( nullptr );
1165}
1166
1167} // End of namespace Functions.
1168
1169/*
1170============================================================
1171============================================================
1172====================== probabilities =======================
1173============================================================
1174============================================================
1175*/
1176namespace Probabilities {
1177
1178LUPI_HOST static nfu_status MCGIDI_NBodyPhaseSpacePDF_callback( statusMessageReporting *smr, double X, double *Y, void *argList );
1179LUPI_HOST static ProbabilityBase1d *ptwXY_To_Xs_pdf_cdf1d( ptwXYPoints *pdfXY );
1180
1181/*
1182============================================================
1183===================== ProbabilityBase ======================
1184============================================================
1185*/
1190/*
1191============================================================
1192*/
1194 Functions::FunctionBase( a_probability ) {
1195
1196}
1197/*
1198============================================================
1199*/
1201 Functions::FunctionBase( a_probability ),
1202 m_Xs( a_Xs ) {
1203
1204}
1205
1206/* *********************************************************************************************************//**
1207 ***********************************************************************************************************/
1208
1212
1213/* *********************************************************************************************************//**
1214 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
1215 * bytes, pack *this* or unpack *this* depending on *a_mode*.
1216 *
1217 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
1218 * @param a_mode [in] Specifies the action of this method.
1219 ***********************************************************************************************************/
1220
1222
1223 Functions::FunctionBase::serialize( a_buffer, a_mode );
1224 DATA_MEMBER_VECTOR_DOUBLE( m_Xs, a_buffer, a_mode );
1225}
1226
1227/*
1228============================================================
1229===================== ProbabilityBase1d ====================
1230============================================================
1231*/
1236/*
1237============================================================
1238*/
1240 ProbabilityBase( a_probability, a_Xs ),
1242
1243}
1244
1245/* *********************************************************************************************************//**
1246 ***********************************************************************************************************/
1247
1251
1252/* *********************************************************************************************************//**
1253 * Returns a String representation of the **ProbabilityBase1d** type of *this*.
1254 *
1255 * @return A String instance.
1256 ***********************************************************************************************************/
1257
1259
1260 String typeStr( "ProbabilityBase1d::" );
1261
1262 switch( m_type ) {
1264 typeStr += "none";
1265 break;
1267 typeStr += "xs_pdf_cdf";
1268 break;
1269 }
1270
1271 return( typeStr );
1272}
1273
1274/* *********************************************************************************************************//**
1275 * Returns the value of the function at *a_x1*.
1276 *
1277 * @param a_x1 [in] The x-value to evaluate the function at.
1278 *
1279 * @return The value of the function at *a_x1*.
1280 ***********************************************************************************************************/
1281
1283
1284 return( static_cast<Xs_pdf_cdf1d const *>( this )->evaluate( a_x1 ) );
1285}
1286
1287/* *********************************************************************************************************//**
1288 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
1289 * bytes, pack *this* or unpack *this* depending on *a_mode*.
1290 *
1291 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
1292 * @param a_mode [in] Specifies the action of this method.
1293 ***********************************************************************************************************/
1294
1296
1297 ProbabilityBase::serialize( a_buffer, a_mode );
1298
1299 int type = 0;
1300
1301 if( a_mode != LUPI::DataBuffer::Mode::Unpack ) {
1302 switch( m_type ) {
1304 break;
1306 type = 1;
1307 break;
1308 }
1309 }
1310
1311 DATA_MEMBER_INT( type, a_buffer, a_mode );
1312
1313 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
1314 switch( type ) {
1315 case 0 :
1317 break;
1318 case 1 :
1320 break;
1321 }
1322 }
1323}
1324
1325/*
1326============================================================
1327======================= Xs_pdf_cdf1d =======================
1328============================================================
1329*/
1331 m_pdf( ),
1332 m_cdf( ) {
1333
1335}
1336/*
1337============================================================
1338*/
1340 ProbabilityBase1d( a_xs_pdf_cdf1d, a_xs_pdf_cdf1d.Xs( ) ),
1341 m_pdf( a_xs_pdf_cdf1d.pdf( ) ),
1342 m_cdf( a_xs_pdf_cdf1d.cdf( ) ) {
1343
1345}
1346
1347/* *********************************************************************************************************//**
1348 ***********************************************************************************************************/
1349
1353/*
1354============================================================
1355*/
1356LUPI_HOST_DEVICE double Xs_pdf_cdf1d::evaluate( double a_x1 ) const {
1357
1358 int intLower = binarySearchVector( a_x1, m_Xs );
1359
1360 if( intLower < 0 ) {
1361 if( intLower == -2 ) return( m_pdf[0] );
1362 return( m_pdf.back( ) );
1363 }
1364
1365 std::size_t lower = static_cast<std::size_t>( intLower );
1366 double fraction = ( a_x1 - m_Xs[lower] ) / ( m_Xs[lower+1] - m_Xs[lower] );
1367
1368 return( ( 1. - fraction ) * m_pdf[lower] + fraction * m_pdf[lower+1] );
1369}
1370
1371/* *********************************************************************************************************//**
1372 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
1373 * bytes, pack *this* or unpack *this* depending on *a_mode*.
1374 *
1375 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
1376 * @param a_mode [in] Specifies the action of this method.
1377 ***********************************************************************************************************/
1378
1380
1381 ProbabilityBase1d::serialize( a_buffer, a_mode );
1382
1383 DATA_MEMBER_VECTOR_DOUBLE( m_pdf, a_buffer, a_mode );
1384 DATA_MEMBER_VECTOR_DOUBLE( m_cdf, a_buffer, a_mode );
1385}
1386
1387/*
1388============================================================
1389===================== ProbabilityBase2d ====================
1390============================================================
1391*/
1396/*
1397============================================================
1398*/
1404/*
1405============================================================
1406*/
1408 ProbabilityBase( a_probability, a_Xs ),
1410
1411}
1412
1413/* *********************************************************************************************************//**
1414 ***********************************************************************************************************/
1415
1419
1420/* *********************************************************************************************************//**
1421 * Returns a String representation of the **ProbabilityBase2d** type of *this*.
1422 *
1423 * @return A String instance.
1424 ***********************************************************************************************************/
1425
1427
1428 String typeStr( "ProbabilityBase2d::" );
1429
1430 switch( m_type ) {
1432 typeStr += "none";
1433 break;
1435 typeStr += "XYs";
1436 break;
1438 typeStr += "regions";
1439 break;
1441 typeStr += "isotropic";
1442 break;
1444 typeStr += "discreteGamma";
1445 break;
1447 typeStr += "primaryGamma";
1448 break;
1450 typeStr += "recoil";
1451 break;
1453 typeStr += "NBodyPhaseSpace";
1454 break;
1456 typeStr += "evaporation";
1457 break;
1459 typeStr += "generalEvaporation";
1460 break;
1462 typeStr += "simpleMaxwellianFission";
1463 break;
1465 typeStr += "Watt";
1466 break;
1468 typeStr += "weightedFunctionals";
1469 break;
1470 }
1471
1472 return( typeStr );
1473}
1474
1475/* *********************************************************************************************************//**
1476 * This method returns the value of pdf(x1|x2) at x1 of *a_x1* and x2 of *a_x2*.
1477 *
1478 * @param a_x2 [in] The value of x2.
1479 * @param a_x1 [in] The value of x1.
1480 ***********************************************************************************************************/
1481
1482LUPI_HOST_DEVICE double ProbabilityBase2d::evaluate( double a_x2, double a_x1 ) const {
1483
1484 double value = 0.0;
1485
1486 switch( type( ) ) {
1488 break;
1490 value = static_cast<WeightedFunctionals2d const *>( this )->evaluate( a_x2, a_x1 );
1491 break;
1492 default:
1493 value = static_cast<ProbabilityBase2d_d1 const *>( this )->evaluate( a_x2, a_x1 );
1494 break;
1495 }
1496
1497 return( value );
1498}
1499
1500/* *********************************************************************************************************//**
1501 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
1502 * bytes, pack *this* or unpack *this* depending on *a_mode*.
1503 *
1504 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
1505 * @param a_mode [in] Specifies the action of this method.
1506 ***********************************************************************************************************/
1507
1512
1513/* *********************************************************************************************************//**
1514 * Returns the value of the function evaluated at the point (*a_x2*, *a_x1*).
1515 *
1516 * @param a_x2 [in] Value of the outer most independent variable (i.e., *x2*).
1517 * @param a_x1 [in] Value of the inner most independent variable (i.e., *x1*).
1518 *
1519 * @return The value of the function at *a_x2* and *a_x1*.
1520 ***********************************************************************************************************/
1521
1522LUPI_HOST_DEVICE double ProbabilityBase2d_d1::evaluate( double a_x2, double a_x1 ) const {
1523
1524 double value = 0.0;
1525
1526 switch( type( ) ) {
1537 value = static_cast<ProbabilityBase2d_d2 const *>( this )->evaluate( a_x2, a_x1 );
1538 break;
1540 value = static_cast<Regions2d const *>( this )->evaluate( a_x2, a_x1 );
1541 break;
1544 LUPI_THROW( "ProbabilityBase2d_d1::evaluate: This should never happen." );
1545 }
1546
1547 return( value );
1548}
1549
1550/* *********************************************************************************************************//**
1551 * Returns the value of the function evaluated at the point (*a_x2*, *a_x1*).
1552 *
1553 * @param a_x2 [in] Value of the outer most independent variable (i.e., *x2*).
1554 * @param a_x1 [in] Value of the inner most independent variable (i.e., *x1*).
1555 *
1556 * @return The value of the function at *a_x2* and *a_x1*.
1557 ***********************************************************************************************************/
1558
1559LUPI_HOST_DEVICE double ProbabilityBase2d_d2::evaluate( double a_x2, double a_x1 ) const {
1560
1561 double value = 0.0;
1562
1563 switch( type( ) ) {
1565 value = static_cast<XYs2d const *>( this )->evaluate( a_x2, a_x1 );
1566 break;
1568 value = static_cast<Isotropic2d const *>( this )->evaluate( a_x2, a_x1 );
1569 break;
1571 value = static_cast<DiscreteGamma2d const *>( this )->evaluate( a_x2, a_x1 );
1572 break;
1574 value = static_cast<PrimaryGamma2d const *>( this )->evaluate( a_x2, a_x1 );
1575 break;
1577 value = static_cast<Recoil2d const *>( this )->evaluate( a_x2, a_x1 );
1578 break;
1580 value = static_cast<NBodyPhaseSpace2d const *>( this )->evaluate( a_x2, a_x1 );
1581 break;
1583 value = static_cast<Evaporation2d const *>( this )->evaluate( a_x2, a_x1 );
1584 break;
1586 value = static_cast<GeneralEvaporation2d const *>( this )->evaluate( a_x2, a_x1 );
1587 break;
1589 value = static_cast<SimpleMaxwellianFission2d const *>( this )->evaluate( a_x2, a_x1 );
1590 break;
1592 value = static_cast<Watt2d const *>( this )->evaluate( a_x2, a_x1 );
1593 break;
1597 LUPI_THROW( "ProbabilityBase2d_d2::evaluate: This should never happen." );
1598 }
1599
1600 return( value );
1601}
1602
1603/*
1604============================================================
1605========================== XYs2d ===========================
1606============================================================
1607*/
1609 m_probabilities( ) {
1610
1612}
1613/*
1614============================================================
1615*/
1617 ProbabilityBase2d_d2( a_XYs2d, a_XYs2d.Xs( ) ) {
1618
1620
1621 Vector<GIDI::Functions::Function1dForm *> const &function1ds = a_XYs2d.function1ds( );
1622 m_probabilities.resize( function1ds.size( ) );
1623 for( std::size_t i1 = 0; i1 < function1ds.size( ); ++i1 ) m_probabilities[i1] = parseProbability1d( function1ds[i1] );
1624}
1625
1626/* *********************************************************************************************************//**
1627 ***********************************************************************************************************/
1628
1630
1631 for( std::size_t i1 = 0; i1 < m_probabilities.size( ); ++i1 ) delete m_probabilities[i1];
1632}
1633/*
1634============================================================
1635*/
1636LUPI_HOST_DEVICE double XYs2d::evaluate( double a_x2, double a_x1 ) const {
1637
1638 int intLower = binarySearchVector( a_x2, m_Xs );
1639
1640 if( intLower < 0 ) {
1641 if( intLower == -2 ) return( m_probabilities[0]->evaluate( a_x1 ) );
1642 return( m_probabilities.back( )->evaluate( a_x1 ) );
1643 }
1644
1645 std::size_t lower = static_cast<std::size_t>( intLower );
1646 double fraction = ( a_x2 - m_Xs[lower] ) / ( m_Xs[lower+1] - m_Xs[lower] );
1647 double d_value = ( 1.0 - fraction ) * m_probabilities[lower]->evaluate( a_x1 ) + fraction * m_probabilities[lower+1]->evaluate( a_x1 );
1648
1649 return( d_value );
1650}
1651
1652/* *********************************************************************************************************//**
1653 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
1654 * bytes, pack *this* or unpack *this* depending on *a_mode*.
1655 *
1656 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
1657 * @param a_mode [in] Specifies the action of this method.
1658 ***********************************************************************************************************/
1659
1661
1662 ProbabilityBase2d::serialize( a_buffer, a_mode );
1663
1664 std::size_t vectorSize = m_probabilities.size( );
1665 int vectorSizeInt = (int) vectorSize;
1666 DATA_MEMBER_INT( vectorSizeInt, a_buffer, a_mode );
1667 vectorSize = (std::size_t) vectorSizeInt;
1668
1669 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) m_probabilities.resize( vectorSize, &a_buffer.m_placement );
1670 if( a_mode == LUPI::DataBuffer::Mode::Memory ) a_buffer.m_placement += m_probabilities.internalSize();
1671
1672 for( std::size_t vectorIndex = 0; vectorIndex < vectorSize; ++vectorIndex ) {
1673 m_probabilities[vectorIndex] = serializeProbability1d( a_buffer, a_mode, m_probabilities[vectorIndex] );
1674 }
1675}
1676
1677/*
1678============================================================
1679======================== Regions2d =========================
1680============================================================
1681*/
1683 m_probabilities( ) {
1684
1686}
1687/*
1688============================================================
1689*/
1691 ProbabilityBase2d_d1( a_regions2d, a_regions2d.Xs( ) ) {
1692
1694
1695 Vector<GIDI::Functions::Function2dForm *> const &function2ds = a_regions2d.function2ds( );
1696 m_probabilities.resize( function2ds.size( ) );
1697 for( std::size_t i1 = 0; i1 < function2ds.size( ); ++i1 ) m_probabilities[i1] = parseProbability2d_d2( function2ds[i1], nullptr );
1698}
1699
1700/* *********************************************************************************************************//**
1701 ***********************************************************************************************************/
1702
1704
1705 for( std::size_t i1 = 0; i1 < m_probabilities.size( ); ++i1 ) delete m_probabilities[i1];
1706}
1707/*
1708============================================================
1709*/
1710LUPI_HOST_DEVICE double Regions2d::evaluate( double a_x2, double a_x1 ) const {
1711
1712 int intLower = binarySearchVector( a_x2, m_Xs );
1713
1714 if( intLower < 0 ) {
1715 if( intLower == -1 ) { // a_x2 > last value of m_Xs.
1716 return( m_probabilities.back( )->evaluate( a_x2, a_x1 ) );
1717 }
1718 intLower = 0; // a_x2 < first value of m_Xs.
1719 }
1720
1721 std::size_t lower = static_cast<std::size_t>( intLower );
1722
1723 return( m_probabilities[lower]->evaluate( a_x2, a_x1 ) );
1724}
1725
1726/* *********************************************************************************************************//**
1727 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
1728 * bytes, pack *this* or unpack *this* depending on *a_mode*.
1729 *
1730 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
1731 * @param a_mode [in] Specifies the action of this method.
1732 ***********************************************************************************************************/
1733
1735
1736 ProbabilityBase2d::serialize( a_buffer, a_mode );
1737
1738 std::size_t vectorSize = m_probabilities.size( );
1739 int vectorSizeInt = (int) vectorSize;
1740 DATA_MEMBER_INT( vectorSizeInt, a_buffer, a_mode );
1741 vectorSize = (std::size_t) vectorSizeInt;
1742
1743 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) m_probabilities.resize( vectorSize, &a_buffer.m_placement );
1744 if( a_mode == LUPI::DataBuffer::Mode::Memory ) a_buffer.m_placement += m_probabilities.internalSize();
1745 for( std::size_t vectorIndex = 0; vectorIndex < vectorSize; ++vectorIndex ) {
1746 m_probabilities[vectorIndex] = serializeProbability2d_d2( a_buffer, a_mode, m_probabilities[vectorIndex] );
1747 }
1748}
1749
1750
1751/*
1752============================================================
1753======================== Isotropic2d =======================
1754============================================================
1755*/
1760/*
1761============================================================
1762*/
1768
1769/* *********************************************************************************************************//**
1770 ***********************************************************************************************************/
1771
1775
1776/*
1777============================================================
1778====================== DiscreteGamma2d =====================
1779============================================================
1780*/
1786/*
1787============================================================
1788*/
1790 ProbabilityBase2d_d2( a_discreteGamma2d ),
1791 m_value( a_discreteGamma2d.value( ) ) {
1792
1794}
1795
1796/* *********************************************************************************************************//**
1797 ***********************************************************************************************************/
1798
1802
1803/* *********************************************************************************************************//**
1804 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
1805 * bytes, pack *this* or unpack *this* depending on *a_mode*.
1806 *
1807 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
1808 * @param a_mode [in] Specifies the action of this method.
1809 ***********************************************************************************************************/
1810
1812
1813 ProbabilityBase2d::serialize( a_buffer, a_mode );
1814 DATA_MEMBER_DOUBLE( m_value, a_buffer, a_mode );
1815}
1816
1817/*
1818============================================================
1819====================== PrimaryGamma2d =====================
1820============================================================
1821*/
1823 m_primaryEnergy( 0.0 ),
1824 m_massFactor( 0.0 ),
1825 m_finalState( "" ),
1826 m_initialStateIndex( -1 ) {
1827
1829}
1830/*
1831============================================================
1832*/
1834 ProbabilityBase2d_d2( a_primaryGamma2d ),
1835 m_primaryEnergy( a_primaryGamma2d.value( ) ),
1836 m_massFactor( a_setupInfo->m_protare.targetMass( ) / ( a_setupInfo->m_protare.projectileMass( ) + a_setupInfo->m_protare.targetMass( ) ) ),
1837 m_finalState( a_primaryGamma2d.finalState( ).c_str( ) ),
1838 m_initialStateIndex( -1 ) {
1839
1840 if( m_finalState.size( ) > 0 ) a_setupInfo->m_hasFinalStatePhotons = true;
1842
1843 if( a_primaryGamma2d.finalState( ) != "" ) {
1844 std::map<std::string,int>::iterator iter = a_setupInfo->m_stateNamesToIndices.find( a_primaryGamma2d.finalState( ) );
1845 if( iter == a_setupInfo->m_stateNamesToIndices.end( ) ) {
1846 std::string message( "Branching1d: final state not found: pid = '" + a_primaryGamma2d.finalState( ) + "'." );
1847 throw std::runtime_error( message.c_str( ) );
1848 }
1849 m_initialStateIndex = iter->second;
1850
1851 a_setupInfo->m_initialStateIndex = m_initialStateIndex;
1852 }
1853}
1854
1855/* *********************************************************************************************************//**
1856 ***********************************************************************************************************/
1857
1861/*
1862============================================================
1863*/
1864LUPI_HOST_DEVICE double PrimaryGamma2d::evaluate( double a_x2, double a_x1 ) const {
1865
1866 double energy_out = m_primaryEnergy + a_x2 * m_massFactor;
1867
1868// FIXME. I think this is correct but is it what we want.
1869 if( energy_out == a_x1 ) return( 1.0 );
1870 return( 0.0 );
1871}
1872
1873/* *********************************************************************************************************//**
1874 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
1875 * bytes, pack *this* or unpack *this* depending on *a_mode*.
1876 *
1877 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
1878 * @param a_mode [in] Specifies the action of this method.
1879 ***********************************************************************************************************/
1880
1882
1883 ProbabilityBase2d::serialize( a_buffer, a_mode );
1884 DATA_MEMBER_DOUBLE( m_primaryEnergy, a_buffer, a_mode );
1885 DATA_MEMBER_DOUBLE( m_massFactor, a_buffer, a_mode );
1886 DATA_MEMBER_STRING( m_finalState, a_buffer, a_mode );
1887 DATA_MEMBER_INT( m_initialStateIndex, a_buffer, a_mode );
1888}
1889
1890/*
1891============================================================
1892========================= Recoil2d =========================
1893============================================================
1894*/
1900/*
1901============================================================
1902*/
1904 ProbabilityBase2d_d2( a_recoil2d ),
1905 m_xlink( a_recoil2d.xlink( ).c_str( ) ) {
1906
1908}
1909
1910/* *********************************************************************************************************//**
1911 ***********************************************************************************************************/
1912
1916/*
1917============================================================
1918*/
1919LUPI_HOST_DEVICE double Recoil2d::evaluate( LUPI_maybeUnused double a_x2, LUPI_maybeUnused double a_x1 ) const {
1920
1921#if !defined(__NVCC__) && !defined(__HIP__)
1922 LUPI_THROW( "Recoil2d::evaluate: not implemented." );
1923#endif
1924
1925 return( 0.0 );
1926}
1927
1928/* *********************************************************************************************************//**
1929 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
1930 * bytes, pack *this* or unpack *this* depending on *a_mode*.
1931 *
1932 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
1933 * @param a_mode [in] Specifies the action of this method.
1934 ***********************************************************************************************************/
1935
1937
1938 ProbabilityBase2d::serialize( a_buffer, a_mode );
1939 DATA_MEMBER_STRING( m_xlink, a_buffer, a_mode );
1940}
1941
1942/*
1943============================================================
1944==================== NBodyPhaseSpace2d =====================
1945============================================================
1946*/
1948 m_numberOfProducts( 0 ),
1949 m_mass( 0.0 ),
1950 m_energy_in_COMFactor( 0.0 ),
1951 m_massFactor( 0.0 ),
1952 m_Q( 0.0 ),
1953 m_dist( nullptr ) {
1954
1956}
1957/*
1958============================================================
1959*/
1961 ProbabilityBase2d_d2( a_NBodyPhaseSpace2d ),
1962 m_numberOfProducts( a_NBodyPhaseSpace2d.numberOfProducts( ) ),
1963 m_mass( PoPI_AMU2MeV_c2 * a_NBodyPhaseSpace2d.mass( ).value( ) ),
1964 m_energy_in_COMFactor( a_setupInfo->m_protare.targetMass( ) / ( a_setupInfo->m_protare.projectileMass( ) + a_setupInfo->m_protare.targetMass( ) ) ),
1965 m_massFactor( 1 - a_setupInfo->m_product1Mass / m_mass ),
1966 m_Q( a_setupInfo->m_Q ),
1967 m_dist( nullptr ) {
1968
1970 double xs[2] = { 0.0, 1.0 };
1971 ptwXYPoints *pdf = nullptr;
1972
1973 pdf = ptwXY_createFromFunction( nullptr, 2, xs, MCGIDI_NBodyPhaseSpacePDF_callback, (void *) &m_numberOfProducts, 1e-3, 0, 16 );
1974 if( pdf == nullptr ) throw std::runtime_error( "NBodyPhaseSpace2d::NBodyPhaseSpace2d: ptwXY_createFromFunction returned nullptr" );
1975
1976 m_dist = ptwXY_To_Xs_pdf_cdf1d( pdf );
1977 ptwXY_free( pdf );
1978}
1979
1980/* *********************************************************************************************************//**
1981 ***********************************************************************************************************/
1982
1987/*
1988============================================================
1989*/
1990LUPI_HOST static nfu_status MCGIDI_NBodyPhaseSpacePDF_callback( LUPI_maybeUnused statusMessageReporting *smr, double X, double *Y, void *argList ) {
1991
1992 int numberOfProducts = *((int *) argList);
1993 double exponent = 0.5 * ( 3 * numberOfProducts - 8 );
1994
1995 *Y = sqrt( X ) * pow( 1.0 - X, exponent );
1996 return( nfu_Okay );
1997}
1998/*
1999============================================================
2000*/
2001LUPI_HOST_DEVICE double NBodyPhaseSpace2d::evaluate( double a_x2, double a_x1 ) const {
2002
2003 double EMax = ( m_energy_in_COMFactor * a_x2 + m_Q ) * m_massFactor;
2004 double x1 = a_x1 / EMax;
2005
2006 return( m_dist->evaluate( x1 ) );
2007}
2008
2009/* *********************************************************************************************************//**
2010 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
2011 * bytes, pack *this* or unpack *this* depending on *a_mode*.
2012 *
2013 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
2014 * @param a_mode [in] Specifies the action of this method.
2015 ***********************************************************************************************************/
2016
2018
2019 ProbabilityBase2d::serialize( a_buffer, a_mode );
2020 DATA_MEMBER_INT( m_numberOfProducts, a_buffer, a_mode );
2021 DATA_MEMBER_DOUBLE( m_mass, a_buffer, a_mode );
2022 DATA_MEMBER_DOUBLE( m_energy_in_COMFactor, a_buffer, a_mode );
2023 DATA_MEMBER_DOUBLE( m_massFactor, a_buffer, a_mode );
2024 DATA_MEMBER_DOUBLE( m_Q, a_buffer, a_mode );
2025
2026 m_dist = serializeProbability1d( a_buffer, a_mode, m_dist );
2027}
2028
2029/*
2030============================================================
2031====================== Evaporation2d =======================
2032============================================================
2033*/
2035 m_U( 0.0 ),
2036 m_theta( nullptr ) {
2037
2039}
2040/*
2041============================================================
2042*/
2044 ProbabilityBase2d_d2( a_evaporation2d ),
2045 m_U( a_evaporation2d.U( ) ),
2046 m_theta( Functions::parseFunction1d_d1( a_evaporation2d.theta( ) ) ) {
2047
2049}
2050
2051/* *********************************************************************************************************//**
2052 ***********************************************************************************************************/
2053
2055
2056 delete m_theta;
2057}
2058/*
2059============================================================
2060*/
2061LUPI_HOST_DEVICE double Evaporation2d::evaluate( double a_x2, double a_x1 ) const {
2062
2063 double theta = m_theta->evaluate( a_x2 );
2064 double E_U_theta = ( a_x2 - m_U ) / theta;
2065 double Ep_theta = a_x1 / theta;
2066
2067 if( E_U_theta < 0 ) return( 0.0 );
2068 return( Ep_theta * exp( -Ep_theta ) / ( theta * ( 1.0 - exp( -E_U_theta ) * ( 1.0 + E_U_theta ) ) ) );
2069}
2070
2071/* *********************************************************************************************************//**
2072 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
2073 * bytes, pack *this* or unpack *this* depending on *a_mode*.
2074 *
2075 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
2076 * @param a_mode [in] Specifies the action of this method.
2077 ***********************************************************************************************************/
2078
2080
2081 ProbabilityBase2d::serialize( a_buffer, a_mode );
2082 DATA_MEMBER_DOUBLE( m_U, a_buffer, a_mode );
2083
2084 m_theta = serializeFunction1d_d1( a_buffer, a_mode, m_theta );
2085}
2086
2087/*
2088============================================================
2089=================== GeneralEvaporation2d ===================
2090============================================================
2091*/
2093 m_theta( nullptr ),
2094 m_g( nullptr ) {
2095
2097}
2098/*
2099============================================================
2100*/
2102 ProbabilityBase2d_d2( a_generalEvaporation2d ),
2103 m_theta( Functions::parseFunction1d_d1( a_generalEvaporation2d.theta( ) ) ),
2104 m_g( parseProbability1d( a_generalEvaporation2d.g( ) ) ) {
2105
2107}
2108
2109/* *********************************************************************************************************//**
2110 ***********************************************************************************************************/
2111
2113
2114 delete m_theta;
2115 delete m_g;
2116}
2117/*
2118============================================================
2119*/
2120LUPI_HOST_DEVICE double GeneralEvaporation2d::evaluate( double a_x2, double a_x1 ) const {
2121
2122 return( m_g->evaluate( a_x1 / m_theta->evaluate( a_x2 ) ) );
2123}
2124
2125/* *********************************************************************************************************//**
2126 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
2127 * bytes, pack *this* or unpack *this* depending on *a_mode*.
2128 *
2129 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
2130 * @param a_mode [in] Specifies the action of this method.
2131 ***********************************************************************************************************/
2132
2134
2135 ProbabilityBase2d::serialize( a_buffer, a_mode );
2136 m_theta = serializeFunction1d_d1( a_buffer, a_mode, m_theta );
2137 m_g = serializeProbability1d( a_buffer, a_mode, m_g );
2138}
2139
2140/*
2141============================================================
2142================ SimpleMaxwellianFission2d =================
2143============================================================
2144*/
2151/*
2152============================================================
2153*/
2155 ProbabilityBase2d_d2( a_simpleMaxwellianFission2d ),
2156 m_U( a_simpleMaxwellianFission2d.U( ) ),
2157 m_theta( Functions::parseFunction1d_d1( a_simpleMaxwellianFission2d.theta( ) ) ) {
2158
2160}
2161
2162/* *********************************************************************************************************//**
2163 ***********************************************************************************************************/
2164
2169/*
2170============================================================
2171*/
2172LUPI_HOST_DEVICE double SimpleMaxwellianFission2d::evaluate( double a_x2, double a_x1 ) const {
2173
2174 double theta = m_theta->evaluate( a_x2 );
2175 double E_U_theta = ( a_x2 - m_U ) / theta;
2176
2177 if( E_U_theta < 0 ) return( 0.0 );
2178
2179 double Ep_theta = a_x1 / theta;
2180 double sqrt_E_U_theta = sqrt( E_U_theta );
2181
2182 return( sqrt( Ep_theta ) * exp( -Ep_theta ) / ( theta * ( erf( sqrt_E_U_theta ) / M_2_SQRTPI - sqrt_E_U_theta * exp( -E_U_theta ) ) ) );
2183}
2184
2185/* *********************************************************************************************************//**
2186 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
2187 * bytes, pack *this* or unpack *this* depending on *a_mode*.
2188 *
2189 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
2190 * @param a_mode [in] Specifies the action of this method.
2191 ***********************************************************************************************************/
2192
2194
2195 ProbabilityBase2d::serialize( a_buffer, a_mode );
2196 DATA_MEMBER_DOUBLE( m_U, a_buffer, a_mode );
2197 m_theta = serializeFunction1d_d1( a_buffer, a_mode, m_theta );
2198}
2199
2200/*
2201============================================================
2202========================= Watt2d ===========================
2203============================================================
2204*/
2206 m_U( 0.0 ),
2207 m_a( nullptr ),
2208 m_b( nullptr ) {
2209
2211}
2212/*
2213============================================================
2214*/
2216 ProbabilityBase2d_d2( a_Watt2d ),
2217 m_U( a_Watt2d.U( ) ),
2218 m_a( Functions::parseFunction1d_d1( a_Watt2d.a( ) ) ),
2219 m_b( Functions::parseFunction1d_d1( a_Watt2d.b( ) ) ) {
2220
2222}
2223
2224/* *********************************************************************************************************//**
2225 ***********************************************************************************************************/
2226
2228
2229 delete m_a;
2230 delete m_b;
2231}
2232/*
2233============================================================
2234*/
2235LUPI_HOST_DEVICE double Watt2d::evaluate( double a_x2, double a_x1 ) const {
2236
2237 double Watt_a = m_a->evaluate( a_x2 );
2238 double E_U_a = ( a_x2 - m_U ) / Watt_a;
2239
2240 if( E_U_a < 0 ) return( 0.0 );
2241
2242 double Watt_b = m_b->evaluate( a_x2 );
2243 double sqrt_ab_4 = 0.5 * sqrt( Watt_a * Watt_b );
2244 double sqrt_E_U_a = sqrt( E_U_a );
2245
2246 double I = 0.5 * sqrt_ab_4 * Watt_a * sqrt( M_PI ) * ( erf( sqrt_E_U_a - sqrt_ab_4 ) + erf( sqrt_E_U_a + sqrt_ab_4 ) )
2247 - Watt_a * exp( -E_U_a ) * sinh( 2.0 * sqrt_E_U_a * sqrt_ab_4 );
2248 return( exp( -a_x1 / Watt_a ) * sinh( sqrt( Watt_b * a_x1 ) ) / I );
2249}
2250
2251/* *********************************************************************************************************//**
2252 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
2253 * bytes, pack *this* or unpack *this* depending on *a_mode*.
2254 *
2255 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
2256 * @param a_mode [in] Specifies the action of this method.
2257 ***********************************************************************************************************/
2258
2260
2261 ProbabilityBase2d::serialize( a_buffer, a_mode );
2262 DATA_MEMBER_DOUBLE( m_U, a_buffer, a_mode );
2263 m_a = serializeFunction1d_d1( a_buffer, a_mode, m_a );
2264 m_b = serializeFunction1d_d1( a_buffer, a_mode, m_b );
2265}
2266
2267/*
2268============================================================
2269=================== WeightedFunctionals2d ==================
2270============================================================
2271*/
2278/*
2279============================================================
2280*/
2282 ProbabilityBase2d( a_weightedFunctionals2d ) {
2283
2285
2286 Vector<GIDI::Functions::Weighted_function2d *> const &weighted_function2d = a_weightedFunctionals2d.weighted_function2d( );
2287 m_weight.resize( weighted_function2d.size( ) );
2288 m_energy.resize( weighted_function2d.size( ) );
2289 for( std::size_t i1 = 0; i1 < weighted_function2d.size( ); ++i1 ) {
2290 m_weight[i1] = Functions::parseFunction1d_d1( weighted_function2d[i1]->weight( ) );
2291 m_energy[i1] = parseProbability2d_d1( weighted_function2d[i1]->energy( ), nullptr );
2292 }
2293}
2294
2295/* *********************************************************************************************************//**
2296 ***********************************************************************************************************/
2297
2299
2300 for( std::size_t i1 = 0; i1 < m_weight.size( ); ++i1 ) delete m_weight[i1];
2301 for( std::size_t i1 = 0; i1 < m_energy.size( ); ++i1 ) delete m_energy[i1];
2302}
2303/*
2304============================================================
2305*/
2306LUPI_HOST_DEVICE double WeightedFunctionals2d::evaluate( double a_x2, double a_x1 ) const {
2307
2308 std::size_t n1 = m_weight.size( );
2309 double evaluatedValue = 0;
2310
2311 for( std::size_t i1 = 0; i1 < n1; ++i1 ) {
2312 evaluatedValue += m_weight[i1]->evaluate( a_x2 ) * m_energy[i1]->evaluate( a_x2, a_x1 );
2313 }
2314 return( evaluatedValue );
2315}
2316
2317/* *********************************************************************************************************//**
2318 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
2319 * bytes, pack *this* or unpack *this* depending on *a_mode*.
2320 *
2321 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
2322 * @param a_mode [in] Specifies the action of this method.
2323 ***********************************************************************************************************/
2324
2326
2327 ProbabilityBase2d::serialize( a_buffer, a_mode );
2328
2329 std::size_t vectorSize = m_weight.size( );
2330 int vectorSizeInt = (int) vectorSize;
2331 DATA_MEMBER_INT( vectorSizeInt, a_buffer, a_mode );
2332 vectorSize = (std::size_t) vectorSizeInt;
2333 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) m_weight.resize( vectorSize, &a_buffer.m_placement );
2334 if( a_mode == LUPI::DataBuffer::Mode::Memory ) a_buffer.m_placement += m_weight.internalSize();
2335 for( std::size_t vectorIndex = 0; vectorIndex < vectorSize; ++vectorIndex ) {
2336 m_weight[vectorIndex] = serializeFunction1d_d1( a_buffer, a_mode, m_weight[vectorIndex] );
2337 }
2338
2339 vectorSize = m_energy.size( );
2340 vectorSizeInt = (int) vectorSize;
2341 DATA_MEMBER_INT( vectorSizeInt, a_buffer, a_mode );
2342 vectorSize = (std::size_t) vectorSizeInt;
2343 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) m_energy.resize( vectorSize, &a_buffer.m_placement );
2344 if( a_mode == LUPI::DataBuffer::Mode::Memory ) a_buffer.m_placement += m_energy.internalSize();
2345 for( std::size_t vectorIndex = 0; vectorIndex < vectorSize; ++vectorIndex ) {
2346 m_energy[vectorIndex] = serializeProbability2d_d1( a_buffer, a_mode, m_energy[vectorIndex] );
2347 }
2348}
2349
2350
2351/*
2352============================================================
2353===================== ProbabilityBase3d ====================
2354============================================================
2355*/
2360/*
2361============================================================
2362*/
2364 ProbabilityBase( a_probability, a_Xs ),
2366
2367}
2368
2369/* *********************************************************************************************************//**
2370 ***********************************************************************************************************/
2371
2375
2376/* *********************************************************************************************************//**
2377 * Returns a String representation of the **ProbabilityBase3d** type of *this*.
2378 *
2379 * @return A String instance.
2380 ***********************************************************************************************************/
2381
2383
2384 String typeStr( "ProbabilityBase3d::" );
2385
2386 switch( m_type ) {
2388 typeStr += "none";
2389 break;
2391 typeStr += "XYs";
2392 break;
2393 }
2394
2395 return( typeStr );
2396}
2397
2398/* *********************************************************************************************************//**
2399 * Returns the value of the function f(x3, x2, x1) at x3 = *a_x3*, x2 = *a_x2* and x1 = *a_x1*.
2400 *
2401 * @param a_x3 [in] The x3 value.
2402 * @param a_x2 [in] The x2 value.
2403 * @param a_x1 [in] The x1 value.
2404 *
2405 * @return The value of the function at *a_x1*.
2406 ***********************************************************************************************************/
2407
2408LUPI_HOST_DEVICE double ProbabilityBase3d::evaluate( double a_x3, double a_x2, double a_x1 ) const {
2409
2410 return( static_cast<XYs3d const *>( this )->evaluate( a_x3, a_x2, a_x1 ) );
2411}
2412
2413/* *********************************************************************************************************//**
2414 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
2415 * bytes, pack *this* or unpack *this* depending on *a_mode*.
2416 *
2417 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
2418 * @param a_mode [in] Specifies the action of this method.
2419 ***********************************************************************************************************/
2420
2422
2423 ProbabilityBase::serialize( a_buffer, a_mode );
2424
2425 int type = 0;
2426 if( a_mode != LUPI::DataBuffer::Mode::Unpack ) {
2427 switch( m_type ) {
2429 break;
2431 type = 1;
2432 break;
2433 }
2434 }
2435 DATA_MEMBER_INT( type, a_buffer, a_mode );
2436 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
2437 switch( type ) {
2438 case 0 :
2440 break;
2441 case 1 :
2443 break;
2444 }
2445 }
2446}
2447
2448/*
2449============================================================
2450========================== XYs3d ===========================
2451============================================================
2452*/
2454 m_probabilities( ) {
2455
2457}
2458/*
2459============================================================
2460*/
2462 ProbabilityBase3d( a_XYs3d, a_XYs3d.Xs( ) ) {
2463
2465
2466 Vector<GIDI::Functions::Function2dForm *> const &functions2d = a_XYs3d.function2ds( );
2467 m_probabilities.resize( functions2d.size( ) );
2468 for( std::size_t i1 = 0; i1 < functions2d.size( ); ++i1 ) m_probabilities[i1] = parseProbability2d_d1( functions2d[i1], nullptr );
2469}
2470
2471/* *********************************************************************************************************//**
2472 ***********************************************************************************************************/
2473
2475
2476 for( std::size_t i1 = 0; i1 < m_probabilities.size( ); ++i1 ) delete m_probabilities[i1];
2477}
2478/*
2479============================================================
2480*/
2481LUPI_HOST_DEVICE double XYs3d::evaluate( double a_x3, double a_x2, double a_x1 ) const {
2482
2483 int intLower = binarySearchVector( a_x3, m_Xs );
2484 double evaluatedValue;
2485
2486 if( intLower == -2 ) { // a_x3 < first value of Xs.
2487 evaluatedValue = m_probabilities[0]->evaluate( a_x2, a_x1 ); }
2488 else if( intLower == -1 ) { // a_x3 > last value of Xs.
2489 evaluatedValue = m_probabilities.back( )->evaluate( a_x2, a_x1 ); }
2490 else {
2491 std::size_t lower = static_cast<std::size_t>( intLower );
2492 double value1 = m_probabilities[lower]->evaluate( a_x2, a_x1 );
2493
2495 evaluatedValue = value1; }
2496 else {
2497 double value2 = m_probabilities[lower+1]->evaluate( a_x2, a_x1 );
2498
2500 double fraction = ( m_Xs[lower+1] - a_x3 ) / ( m_Xs[lower+1] - m_Xs[lower] );
2501 evaluatedValue = fraction * value1 + ( 1 - fraction ) * value2 ; }
2502 else if( interpolation( ) == Interpolation::LOGLIN ) {
2503 double fraction = ( m_Xs[lower+1] - a_x3 ) / ( m_Xs[lower+1] - m_Xs[lower] );
2504 evaluatedValue = value2 * pow( value2 / value1, fraction ); }
2505 else if( interpolation( ) == Interpolation::LINLOG ) {
2506 double fraction = log( m_Xs[lower+1] / a_x3 ) / log( m_Xs[lower+1] / m_Xs[lower] );
2507 evaluatedValue = fraction * value1 + ( 1 - fraction ) * value2; }
2508 else if( interpolation( ) == Interpolation::LOGLOG ) {
2509 double fraction = log( m_Xs[lower+1] / a_x3 ) / log( m_Xs[lower+1] / m_Xs[lower] );
2510 evaluatedValue = value2 * pow( value2 / value1, fraction ); }
2511 else { // This should never happen.
2512 LUPI_THROW( "XYs3d::evaluate: unsupported interpolation." );
2513 }
2514 }
2515 }
2516
2517 return( evaluatedValue );
2518}
2519
2520/* *********************************************************************************************************//**
2521 * This method serializes *this* for broadcasting as needed for MPI and GPUs. The method can count the number of required
2522 * bytes, pack *this* or unpack *this* depending on *a_mode*.
2523 *
2524 * @param a_buffer [in] The buffer to read or write data to depending on *a_mode*.
2525 * @param a_mode [in] Specifies the action of this method.
2526 ***********************************************************************************************************/
2527
2529
2530 ProbabilityBase3d::serialize( a_buffer, a_mode );
2531
2532 std::size_t vectorSize = m_probabilities.size( );
2533 int vectorSizeInt = (int) vectorSize;
2534 DATA_MEMBER_INT( vectorSizeInt, a_buffer, a_mode );
2535 vectorSize = (std::size_t) vectorSizeInt;
2536
2537 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) m_probabilities.resize( vectorSize, &a_buffer.m_placement );
2538 if( a_mode == LUPI::DataBuffer::Mode::Memory ) a_buffer.m_placement += m_probabilities.internalSize();
2539 for( std::size_t vectorIndex = 0; vectorIndex < vectorSize; ++vectorIndex ) {
2540 m_probabilities[vectorIndex] = serializeProbability2d_d1( a_buffer, a_mode, m_probabilities[vectorIndex] );
2541 }
2542}
2543
2544/*
2545============================================================
2546========================== others ==========================
2547============================================================
2548*/
2549/*
2550============================================================
2551*/
2553
2554 GIDI::FormType type = a_form1d->type( );
2555
2556 switch( type ) {
2558 return( new Xs_pdf_cdf1d( *static_cast<GIDI::Functions::Xs_pdf_cdf1d const *>( a_form1d ) ) );
2559 default :
2560 throw std::runtime_error( "Probabilities::parseProbability1d: Unsupported Function1d with moniker " + a_form1d->moniker( )
2561 + " at " + a_form1d->toXLink( ) );
2562 }
2563
2564 return( nullptr );
2565}
2566
2567/*
2568============================================================
2569*/
2571
2572 GIDI::FormType type = form2d->type( );
2573
2574 switch( type ) {
2576 return( new XYs2d( *static_cast<GIDI::Functions::XYs2d const *>( form2d ) ) );
2578 return( new Regions2d( *static_cast<GIDI::Functions::Regions2d const *>( form2d ) ) );
2580 return( new Isotropic2d( *static_cast<GIDI::Functions::Isotropic2d const *>( form2d ) ) );
2582 return( new DiscreteGamma2d( *static_cast<GIDI::Functions::DiscreteGamma2d const *>( form2d ) ) );
2584 return( new PrimaryGamma2d( *static_cast<GIDI::Functions::PrimaryGamma2d const *>( form2d ), a_setupInfo ) );
2586 return( new Recoil2d( *static_cast<GIDI::Functions::Recoil2d const *>( form2d ) ) );
2588 return( new NBodyPhaseSpace2d( *static_cast<GIDI::Functions::NBodyPhaseSpace2d const *>( form2d ), a_setupInfo ) );
2590 return( new Evaporation2d( *static_cast<GIDI::Functions::Evaporation2d const *>( form2d ) ) );
2592 return( new GeneralEvaporation2d( *static_cast<GIDI::Functions::GeneralEvaporation2d const *>( form2d ) ) );
2594 return( new SimpleMaxwellianFission2d( *static_cast<GIDI::Functions::SimpleMaxwellianFission2d const *>( form2d ) ) );
2596 return( new Watt2d( *static_cast<GIDI::Functions::Watt2d const *>( form2d ) ) );
2598 return( new WeightedFunctionals2d( *static_cast<GIDI::Functions::WeightedFunctionals2d const *>( form2d ) ) );
2599 default :
2600 throw std::runtime_error( "Probabilities::parseProbability2d: Unsupported Function2d" );
2601 }
2602
2603 return( nullptr );
2604}
2605
2606/*
2607============================================================
2608*/
2610
2611 GIDI::FormType type = form2d->type( );
2612
2613 switch( type ) {
2615 return( new XYs2d( *static_cast<GIDI::Functions::XYs2d const *>( form2d ) ) );
2617 return( new Regions2d( *static_cast<GIDI::Functions::Regions2d const *>( form2d ) ) );
2619 return( new Isotropic2d( *static_cast<GIDI::Functions::Isotropic2d const *>( form2d ) ) );
2621 return( new DiscreteGamma2d( *static_cast<GIDI::Functions::DiscreteGamma2d const *>( form2d ) ) );
2623 return( new PrimaryGamma2d( *static_cast<GIDI::Functions::PrimaryGamma2d const *>( form2d ), a_setupInfo ) );
2625 return( new Recoil2d( *static_cast<GIDI::Functions::Recoil2d const *>( form2d ) ) );
2627 return( new NBodyPhaseSpace2d( *static_cast<GIDI::Functions::NBodyPhaseSpace2d const *>( form2d ), a_setupInfo ) );
2629 return( new Evaporation2d( *static_cast<GIDI::Functions::Evaporation2d const *>( form2d ) ) );
2631 return( new GeneralEvaporation2d( *static_cast<GIDI::Functions::GeneralEvaporation2d const *>( form2d ) ) );
2633 return( new SimpleMaxwellianFission2d( *static_cast<GIDI::Functions::SimpleMaxwellianFission2d const *>( form2d ) ) );
2635 return( new Watt2d( *static_cast<GIDI::Functions::Watt2d const *>( form2d ) ) );
2636 default :
2637 throw std::runtime_error( "Probabilities::parseProbability2d: Unsupported Function2d" );
2638 }
2639
2640 return( nullptr );
2641}
2642
2643/*
2644============================================================
2645*/
2647
2648 GIDI::FormType type = form2d->type( );
2649
2650 switch( type ) {
2652 return( new XYs2d( *static_cast<GIDI::Functions::XYs2d const *>( form2d ) ) );
2654 return( new Isotropic2d( *static_cast<GIDI::Functions::Isotropic2d const *>( form2d ) ) );
2656 return( new DiscreteGamma2d( *static_cast<GIDI::Functions::DiscreteGamma2d const *>( form2d ) ) );
2658 return( new PrimaryGamma2d( *static_cast<GIDI::Functions::PrimaryGamma2d const *>( form2d ), a_setupInfo ) );
2660 return( new NBodyPhaseSpace2d( *static_cast<GIDI::Functions::NBodyPhaseSpace2d const *>( form2d ), a_setupInfo ) );
2662 return( new Evaporation2d( *static_cast<GIDI::Functions::Evaporation2d const *>( form2d ) ) );
2664 return( new GeneralEvaporation2d( *static_cast<GIDI::Functions::GeneralEvaporation2d const *>( form2d ) ) );
2666 return( new SimpleMaxwellianFission2d( *static_cast<GIDI::Functions::SimpleMaxwellianFission2d const *>( form2d ) ) );
2668 return( new Watt2d( *static_cast<GIDI::Functions::Watt2d const *>( form2d ) ) );
2669 default :
2670 throw std::runtime_error( "Probabilities::parseProbability2d: Unsupported Function2d" );
2671 }
2672
2673 return( nullptr );
2674}
2675
2676/*
2677============================================================
2678*/
2680
2681 GIDI::FormType type = form3d->type( );
2682
2683 switch( type ) {
2685 return( new XYs3d( *static_cast<GIDI::Functions::XYs3d const *>( form3d ) ) );
2686 default :
2687 throw std::runtime_error( "Probabilities::parseProbability3d: Unsupported Function3d" );
2688 }
2689
2690 return( nullptr );
2691}
2692
2693/*
2694============================================================
2695*/
2696LUPI_HOST static ProbabilityBase1d *ptwXY_To_Xs_pdf_cdf1d( ptwXYPoints *pdfXY ) {
2697
2698 ptwXPoints *cdfX = nullptr;
2699 ptwXYPoint *point;
2700 std::size_t n1 = (std::size_t) ptwXY_length( nullptr, pdfXY );
2701 std::vector<double> Xs( n1 ), pdf( n1 ), cdf( n1 );
2702
2703 if( ( cdfX = ptwXY_runningIntegral( nullptr, pdfXY ) ) == nullptr ) throw std::runtime_error( "ptwXY_To_Xs_pdf_cdf1d: ptwXY_runningIntegral returned error." );
2704 double norm = ptwX_getPointAtIndex_Unsafely( cdfX, (int64_t) n1 - 1 );
2705 if( norm <= 0 ) throw std::runtime_error( "ptwXY_To_Xs_pdf_cdf1d: norm <= 0." );
2706
2707 norm = 1. / norm;
2708 for( std::size_t i1 = 0; i1 < n1; ++i1 ) {
2709 point = ptwXY_getPointAtIndex_Unsafely( pdfXY, (int64_t) i1 );
2710 Xs[i1] = point->x;
2711 pdf[i1] = norm * point->y;
2712 cdf[i1] = norm * ptwX_getPointAtIndex_Unsafely( cdfX, (int64_t) i1 );
2713 }
2714 cdf[n1-1] = 1.;
2715
2716 ptwX_free( cdfX );
2717
2718 GIDI::Axes axes;
2719 GIDI::Functions::Xs_pdf_cdf1d gidi_xs_pdf_cdf1d( axes, ptwXY_interpolationLinLin, Xs, pdf, cdf );
2720
2721 Xs_pdf_cdf1d *xs_pdf_cdf1d = new Xs_pdf_cdf1d( gidi_xs_pdf_cdf1d );
2722 return( xs_pdf_cdf1d );
2723}
2724
2725} // End of namespace Probabilities.
2726
2727/*
2728============================================================
2729========================== others ==========================
2730============================================================
2731*/
2733
2734 if( a_interpolation == ptwXY_interpolationLinLin ) return( Interpolation::LINLIN );
2735 if( a_interpolation == ptwXY_interpolationLogLin ) return( Interpolation::LOGLIN );
2736 if( a_interpolation == ptwXY_interpolationLinLog ) return( Interpolation::LINLOG );
2737 if( a_interpolation == ptwXY_interpolationLogLog ) return( Interpolation::LOGLOG );
2738 if( a_interpolation == ptwXY_interpolationFlat ) return( Interpolation::FLAT );
2739 return( Interpolation::OTHER );
2740}
2741/*
2742============================================================
2743*/
2745
2746 if( a_function == nullptr ) return( Function1dType::none );
2747 return( a_function->type( ) );
2748}
2749
2750/*
2751============================================================
2752*/
2754 Functions::Function1d *a_function1d ) {
2755
2756 int type = 0;
2757
2758 if( a_mode != LUPI::DataBuffer::Mode::Unpack ) {
2759 Function1dType fType = Function1dClass( a_function1d );
2760
2761 switch( fType ) {
2763 break;
2765 type = 1;
2766 break;
2767 case Function1dType::XYs :
2768 type = 2;
2769 break;
2771 type = 3;
2772 break;
2774 type = 4;
2775 break;
2777 type = 5;
2778 break;
2780 type = 6;
2781 break;
2783 type = 7;
2784 break;
2785 default:
2786 String message( "serializeFunction1d: Unsupported Function1d: " + a_function1d->typeString( ) );
2787 LUPI_THROW( message.c_str( ) );
2788 }
2789 }
2790
2791 DATA_MEMBER_INT( type, a_buffer, a_mode );
2792
2793 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
2794 a_function1d = nullptr;
2795 switch( type ) {
2796 case 0 :
2797 break;
2798 case 1 :
2799 if( a_buffer.m_placement != nullptr ) {
2800 a_function1d = new(a_buffer.m_placement) Functions::Constant1d;
2801 a_buffer.incrementPlacement( sizeof( Functions::Constant1d ) ); }
2802 else {
2803 a_function1d = new Functions::Constant1d;
2804 }
2805 break;
2806 case 2 :
2807 if( a_buffer.m_placement != nullptr ) {
2808 a_function1d = new(a_buffer.m_placement) Functions::XYs1d;
2809 a_buffer.incrementPlacement( sizeof( Functions::XYs1d ) ); }
2810 else {
2811 a_function1d = new Functions::XYs1d;
2812 }
2813 break;
2814 case 3 :
2815 if( a_buffer.m_placement != nullptr ) {
2816 a_function1d = new(a_buffer.m_placement) Functions::Polynomial1d;
2817 a_buffer.incrementPlacement( sizeof( Functions::Polynomial1d ) ); }
2818 else {
2819 a_function1d = new Functions::Polynomial1d;
2820 }
2821 break;
2822 case 4 :
2823 if( a_buffer.m_placement != nullptr ) {
2824 a_function1d = new(a_buffer.m_placement) Functions::Gridded1d;
2825 a_buffer.incrementPlacement( sizeof( Functions::Gridded1d ) ); }
2826 else {
2827 a_function1d = new Functions::Gridded1d;
2828 }
2829 break;
2830 case 5 :
2831 if( a_buffer.m_placement != nullptr ) {
2832 a_function1d = new(a_buffer.m_placement) Functions::Regions1d;
2833 a_buffer.incrementPlacement( sizeof( Functions::Regions1d ) ); }
2834 else {
2835 a_function1d = new Functions::Regions1d;
2836 }
2837 break;
2838 case 6 :
2839 if( a_buffer.m_placement != nullptr ) {
2840 a_function1d = new(a_buffer.m_placement) Functions::Branching1d;
2841 a_buffer.incrementPlacement( sizeof( Functions::Branching1d ) ); }
2842 else {
2843 a_function1d = new Functions::Branching1d;
2844 }
2845 break;
2846 case 7 :
2847 if( a_buffer.m_placement != nullptr ) {
2850 else {
2852 }
2853 break;
2854 default: // This should never happen as Unpack should be called after Pack which checks type.
2855 LUPI_THROW( "serializeFunction1d: Unsupported Function1d:" );
2856 }
2857 }
2858
2859 if( a_mode == LUPI::DataBuffer::Mode::Memory ) {
2860 switch( type ) {
2861 case 0 :
2862 break;
2863 case 1 :
2864 a_buffer.incrementPlacement( sizeof( Functions::Constant1d ) );
2865 break;
2866 case 2 :
2867 a_buffer.incrementPlacement( sizeof( Functions::XYs1d ) );
2868 break;
2869 case 3 :
2870 a_buffer.incrementPlacement( sizeof( Functions::Polynomial1d ) );
2871 break;
2872 case 4 :
2873 a_buffer.incrementPlacement( sizeof( Functions::Gridded1d ) );
2874 break;
2875 case 5 :
2876 a_buffer.incrementPlacement( sizeof( Functions::Regions1d ) );
2877 break;
2878 case 6 :
2879 a_buffer.incrementPlacement( sizeof( Functions::Branching1d ) );
2880 break;
2881 case 7 :
2883 break;
2884 default:
2885 LUPI_THROW( "serializeFunction1d: Unsupported Function1d:" );
2886 }
2887 }
2888
2889 if( a_function1d != nullptr ) {
2890 switch( type ) {
2891 case 0 :
2892 break;
2893 case 1 :
2894 static_cast<Functions::Constant1d *>( a_function1d )->serialize( a_buffer, a_mode );
2895 break;
2896 case 2 :
2897 static_cast<Functions::XYs1d *>( a_function1d )->serialize( a_buffer, a_mode );
2898 break;
2899 case 3 :
2900 static_cast<Functions::Polynomial1d *>( a_function1d )->serialize( a_buffer, a_mode );
2901 break;
2902 case 4 :
2903 static_cast<Functions::Gridded1d *>( a_function1d )->serialize( a_buffer, a_mode );
2904 break;
2905 case 5 :
2906 static_cast<Functions::Regions1d *>( a_function1d )->serialize( a_buffer, a_mode );
2907 break;
2908 case 6 :
2909 static_cast<Functions::Branching1d *>( a_function1d )->serialize( a_buffer, a_mode );
2910 break;
2911 case 7 :
2912 static_cast<Functions::TerrellFissionNeutronMultiplicityModel *>( a_function1d )->serialize( a_buffer, a_mode );
2913 break;
2914 default:
2915 LUPI_THROW( "serializeFunction1d: Unsupported Function1d:" );
2916 }
2917 }
2918
2919 return( a_function1d );
2920}
2921
2922/*
2923============================================================
2924*/
2926 Functions::Function1d_d1 *a_function1d ) {
2927
2928 int type = 0;
2929
2930 if( a_mode != LUPI::DataBuffer::Mode::Unpack ) {
2931 Function1dType fType = Function1dClass( a_function1d );
2932
2933 switch( fType ) {
2935 break;
2937 type = 1;
2938 break;
2939 case Function1dType::XYs :
2940 type = 2;
2941 break;
2943 type = 3;
2944 break;
2946 type = 4;
2947 break;
2949 type = 5;
2950 break;
2952 type = 6;
2953 break;
2954 default:
2955 String message( "serializeFunction1d_d1: Unsupported Function1d: " + a_function1d->typeString( ) );
2956 LUPI_THROW( message.c_str( ) );
2957 }
2958 }
2959
2960 DATA_MEMBER_INT( type, a_buffer, a_mode );
2961
2962 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
2963 a_function1d = nullptr;
2964 switch( type ) {
2965 case 0 :
2966 break;
2967 case 1 :
2968 if( a_buffer.m_placement != nullptr ) {
2969 a_function1d = new(a_buffer.m_placement) Functions::Constant1d;
2970 a_buffer.incrementPlacement( sizeof( Functions::Constant1d ) ); }
2971 else {
2972 a_function1d = new Functions::Constant1d;
2973 }
2974 break;
2975 case 2 :
2976 if( a_buffer.m_placement != nullptr ) {
2977 a_function1d = new(a_buffer.m_placement) Functions::XYs1d;
2978 a_buffer.incrementPlacement( sizeof( Functions::XYs1d ) ); }
2979 else {
2980 a_function1d = new Functions::XYs1d;
2981 }
2982 break;
2983 case 3 :
2984 if( a_buffer.m_placement != nullptr ) {
2985 a_function1d = new(a_buffer.m_placement) Functions::Polynomial1d;
2986 a_buffer.incrementPlacement( sizeof( Functions::Polynomial1d ) ); }
2987 else {
2988 a_function1d = new Functions::Polynomial1d;
2989 }
2990 break;
2991 case 4 :
2992 if( a_buffer.m_placement != nullptr ) {
2993 a_function1d = new(a_buffer.m_placement) Functions::Gridded1d;
2994 a_buffer.incrementPlacement( sizeof( Functions::Gridded1d ) ); }
2995 else {
2996 a_function1d = new Functions::Gridded1d;
2997 }
2998 break;
2999 case 5 :
3000 if( a_buffer.m_placement != nullptr ) {
3001 a_function1d = new(a_buffer.m_placement) Functions::Regions1d;
3002 a_buffer.incrementPlacement( sizeof( Functions::Regions1d ) ); }
3003 else {
3004 a_function1d = new Functions::Regions1d;
3005 }
3006 break;
3007 case 6 :
3008 if( a_buffer.m_placement != nullptr ) {
3009 a_function1d = new(a_buffer.m_placement) Functions::Branching1d;
3010 a_buffer.incrementPlacement( sizeof( Functions::Branching1d ) ); }
3011 else {
3012 a_function1d = new Functions::Branching1d;
3013 }
3014 break;
3015 default: // This should never happen as Unpack should be called after Pack which checks type.
3016 LUPI_THROW( "serializeFunction1d_d1: Unsupported Function1d:" );
3017 }
3018 }
3019
3020 if( a_mode == LUPI::DataBuffer::Mode::Memory ) {
3021 switch( type ) {
3022 case 0 :
3023 break;
3024 case 1 :
3025 a_buffer.incrementPlacement( sizeof( Functions::Constant1d ) );
3026 break;
3027 case 2 :
3028 a_buffer.incrementPlacement( sizeof( Functions::XYs1d ) );
3029 break;
3030 case 3 :
3031 a_buffer.incrementPlacement( sizeof( Functions::Polynomial1d ) );
3032 break;
3033 case 4 :
3034 a_buffer.incrementPlacement( sizeof( Functions::Gridded1d ) );
3035 break;
3036 case 5 :
3037 a_buffer.incrementPlacement( sizeof( Functions::Regions1d ) );
3038 break;
3039 case 6 :
3040 a_buffer.incrementPlacement( sizeof( Functions::Branching1d ) );
3041 break;
3042 default:
3043 LUPI_THROW( "serializeFunction1d_d1: Unsupported Function1d:" );
3044 }
3045 }
3046
3047 if( a_function1d != nullptr ) {
3048 switch( type ) {
3049 case 0 :
3050 break;
3051 case 1 :
3052 static_cast<Functions::Constant1d *>( a_function1d )->serialize( a_buffer, a_mode );
3053 break;
3054 case 2 :
3055 static_cast<Functions::XYs1d *>( a_function1d )->serialize( a_buffer, a_mode );
3056 break;
3057 case 3 :
3058 static_cast<Functions::Polynomial1d *>( a_function1d )->serialize( a_buffer, a_mode );
3059 break;
3060 case 4 :
3061 static_cast<Functions::Gridded1d *>( a_function1d )->serialize( a_buffer, a_mode );
3062 break;
3063 case 5 :
3064 static_cast<Functions::Regions1d *>( a_function1d )->serialize( a_buffer, a_mode );
3065 break;
3066 case 6 :
3067 static_cast<Functions::Branching1d *>( a_function1d )->serialize( a_buffer, a_mode );
3068 break;
3069 default:
3070 LUPI_THROW( "serializeFunction1d_d1: Unsupported Function1d:" );
3071 }
3072 }
3073
3074 return( a_function1d );
3075}
3076
3077/*
3078============================================================
3079*/
3081 Functions::Function1d_d2 *a_function1d ) {
3082
3083 int type = 0;
3084
3085 if( a_mode != LUPI::DataBuffer::Mode::Unpack ) {
3086 Function1dType fType = Function1dClass( a_function1d );
3087
3088 switch( fType ) {
3090 break;
3092 type = 1;
3093 break;
3094 case Function1dType::XYs :
3095 type = 2;
3096 break;
3098 type = 3;
3099 break;
3101 type = 4;
3102 break;
3103 break;
3105 type = 6;
3106 break;
3107 default:
3108 String message( "serializeFunction1d_d2: Unsupported Function1d: " + a_function1d->typeString( ) );
3109 LUPI_THROW( message.c_str( ) );
3110 }
3111 }
3112
3113 DATA_MEMBER_INT( type, a_buffer, a_mode );
3114
3115 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
3116 a_function1d = nullptr;
3117 switch( type ) {
3118 case 0 :
3119 break;
3120 case 1 :
3121 if( a_buffer.m_placement != nullptr ) {
3122 a_function1d = new(a_buffer.m_placement) Functions::Constant1d;
3123 a_buffer.incrementPlacement( sizeof( Functions::Constant1d ) ); }
3124 else {
3125 a_function1d = new Functions::Constant1d;
3126 }
3127 break;
3128 case 2 :
3129 if( a_buffer.m_placement != nullptr ) {
3130 a_function1d = new(a_buffer.m_placement) Functions::XYs1d;
3131 a_buffer.incrementPlacement( sizeof( Functions::XYs1d ) ); }
3132 else {
3133 a_function1d = new Functions::XYs1d;
3134 }
3135 break;
3136 case 3 :
3137 if( a_buffer.m_placement != nullptr ) {
3138 a_function1d = new(a_buffer.m_placement) Functions::Polynomial1d;
3139 a_buffer.incrementPlacement( sizeof( Functions::Polynomial1d ) ); }
3140 else {
3141 a_function1d = new Functions::Polynomial1d;
3142 }
3143 break;
3144 case 4 :
3145 if( a_buffer.m_placement != nullptr ) {
3146 a_function1d = new(a_buffer.m_placement) Functions::Gridded1d;
3147 a_buffer.incrementPlacement( sizeof( Functions::Gridded1d ) ); }
3148 else {
3149 a_function1d = new Functions::Gridded1d;
3150 }
3151 break;
3152 case 6 :
3153 if( a_buffer.m_placement != nullptr ) {
3154 a_function1d = new(a_buffer.m_placement) Functions::Branching1d;
3155 a_buffer.incrementPlacement( sizeof( Functions::Branching1d ) ); }
3156 else {
3157 a_function1d = new Functions::Branching1d;
3158 }
3159 break;
3160 default: // This should never happen as Unpack should be called after Pack which checks type.
3161 LUPI_THROW( "serializeFunction1d_d2: Unsupported Function1d:" );
3162 }
3163 }
3164
3165 if( a_mode == LUPI::DataBuffer::Mode::Memory ) {
3166 switch( type ) {
3167 case 0 :
3168 break;
3169 case 1 :
3170 a_buffer.incrementPlacement( sizeof( Functions::Constant1d ) );
3171 break;
3172 case 2 :
3173 a_buffer.incrementPlacement( sizeof( Functions::XYs1d ) );
3174 break;
3175 case 3 :
3176 a_buffer.incrementPlacement( sizeof( Functions::Polynomial1d ) );
3177 break;
3178 case 4 :
3179 a_buffer.incrementPlacement( sizeof( Functions::Gridded1d ) );
3180 break;
3181 case 6 :
3182 a_buffer.incrementPlacement( sizeof( Functions::Branching1d ) );
3183 break;
3184 default:
3185 LUPI_THROW( "serializeFunction1d_d2: Unsupported Function1d:" );
3186 }
3187 }
3188
3189 if( a_function1d != nullptr ) {
3190 switch( type ) {
3191 case 0 :
3192 break;
3193 case 1 :
3194 static_cast<Functions::Constant1d *>( a_function1d )->serialize( a_buffer, a_mode );
3195 break;
3196 case 2 :
3197 static_cast<Functions::XYs1d *>( a_function1d )->serialize( a_buffer, a_mode );
3198 break;
3199 case 3 :
3200 static_cast<Functions::Polynomial1d *>( a_function1d )->serialize( a_buffer, a_mode );
3201 break;
3202 case 4 :
3203 static_cast<Functions::Gridded1d *>( a_function1d )->serialize( a_buffer, a_mode );
3204 break;
3205 case 6 :
3206 static_cast<Functions::Branching1d *>( a_function1d )->serialize( a_buffer, a_mode );
3207 break;
3208 default:
3209 LUPI_THROW( "serializeFunction1d_d2: Unsupported Function1d:" );
3210 }
3211 }
3212
3213 return( a_function1d );
3214}
3215
3216/*
3217============================================================
3218*/
3220
3221 if( a_function == nullptr ) return( Function2dType::none );
3222 return( a_function->type( ) );
3223}
3224
3225/*
3226============================================================
3227*/
3229
3230 int type = 0;
3231
3232 if( a_mode != LUPI::DataBuffer::Mode::Unpack ) {
3233 Function2dType fType = Function2dClass( a_function2d );
3234
3235 switch( fType ) {
3237 break;
3238 case Function2dType::XYs :
3239 type = 1;
3240 break;
3241 }
3242 }
3243
3244 DATA_MEMBER_INT( type, a_buffer, a_mode );
3245
3246 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
3247 switch( type ) {
3248 case 0 :
3249 a_function2d = nullptr;
3250 break;
3251 case 1 :
3252 if( a_buffer.m_placement != nullptr ) {
3253 a_function2d = new(a_buffer.m_placement) Functions::XYs2d;
3254 a_buffer.incrementPlacement( sizeof( Functions::XYs2d ) ); }
3255 else {
3256 a_function2d = new Functions::XYs2d;
3257 }
3258 break;
3259 }
3260 }
3261
3262 if( a_mode == LUPI::DataBuffer::Mode::Memory ) {
3263 switch( type ) {
3264 case 0 :
3265 break;
3266 case 1 :
3267 a_buffer.incrementPlacement( sizeof( Functions::XYs2d ) );
3268 break;
3269 }
3270 }
3271
3272 if( a_function2d != nullptr ) {
3273 switch( type ) {
3274 case 0 :
3275 break;
3276 case 1 :
3277 static_cast<Functions::XYs2d *>( a_function2d )->serialize( a_buffer, a_mode );
3278 break;
3279 }
3280 }
3281
3282 return( a_function2d );
3283}
3284
3285/*
3286============================================================
3287*/
3289
3290 if( a_function == nullptr ) return( ProbabilityBase1dType::none );
3291 return( a_function->type( ) );
3292}
3293
3294/*
3295============================================================
3296*/
3298 Probabilities::ProbabilityBase1d *a_probability1d ) {
3299
3300 int type = 0;
3301
3302 if( a_mode != LUPI::DataBuffer::Mode::Unpack ) {
3303 ProbabilityBase1dType pType = ProbabilityBase1dClass( a_probability1d );
3304
3305 switch( pType ) {
3307 break;
3309 type = 1;
3310 break;
3311 }
3312 }
3313
3314 DATA_MEMBER_INT( type, a_buffer, a_mode );
3315
3316 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
3317 switch( type ) {
3318 case 0 :
3319 a_probability1d = nullptr;
3320 break;
3321 case 1 :
3322 if( a_buffer.m_placement != nullptr ) {
3323 a_probability1d = new(a_buffer.m_placement) Probabilities::Xs_pdf_cdf1d;
3324 a_buffer.incrementPlacement( sizeof( Probabilities::Xs_pdf_cdf1d ) ); }
3325 else {
3326 a_probability1d = new Probabilities::Xs_pdf_cdf1d;
3327 }
3328 break;
3329 }
3330 }
3331 if( a_mode == LUPI::DataBuffer::Mode::Memory ) {
3332 switch( type ) {
3333 case 0 :
3334 break;
3335 case 1 :
3336 a_buffer.incrementPlacement( sizeof( Probabilities::Xs_pdf_cdf1d ) );
3337 break;
3338 }
3339 }
3340
3341 if( a_probability1d != nullptr ) {
3342 switch( type ) {
3343 case 0 :
3344 break;
3345 case 1 :
3346 static_cast<Probabilities::Xs_pdf_cdf1d *>( a_probability1d )->serialize( a_buffer, a_mode );
3347 break;
3348 }
3349 }
3350
3351 return( a_probability1d );
3352}
3353
3354/*
3355============================================================
3356*/
3358
3359 if( a_function == nullptr ) return( ProbabilityBase2dType::none );
3360 return( a_function->type( ) );
3361}
3362
3363/*
3364============================================================
3365*/
3367 Probabilities::ProbabilityBase2d *a_probability2d ) {
3368
3369 int type = 0;
3370
3371 if( a_mode != LUPI::DataBuffer::Mode::Unpack ) {
3372 ProbabilityBase2dType pType = ProbabilityBase2dClass( a_probability2d );
3373
3374 switch( pType ) {
3376 break;
3378 type = 1;
3379 break;
3381 type = 2;
3382 break;
3384 type = 3;
3385 break;
3387 type = 4;
3388 break;
3390 type = 5;
3391 break;
3393 type = 6;
3394 break;
3396 type = 7;
3397 break;
3399 type = 8;
3400 break;
3402 type = 9;
3403 break;
3405 type = 10;
3406 break;
3408 type = 11;
3409 break;
3411 type = 12;
3412 break;
3413 }
3414 }
3415
3416 DATA_MEMBER_INT( type, a_buffer, a_mode );
3417
3418 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
3419 switch( type ) {
3420 case 0 :
3421 a_probability2d = nullptr;
3422 break;
3423 case 1 :
3424 if( a_buffer.m_placement != nullptr ) {
3425 a_probability2d = new(a_buffer.m_placement) Probabilities::XYs2d;
3426 a_buffer.incrementPlacement( sizeof( Probabilities::XYs2d ) ); }
3427 else {
3428 a_probability2d = new Probabilities::XYs2d;
3429 }
3430 break;
3431 case 2 :
3432 if( a_buffer.m_placement != nullptr ) {
3433 a_probability2d = new(a_buffer.m_placement) Probabilities::Regions2d;
3434 a_buffer.incrementPlacement( sizeof( Probabilities::Regions2d ) ); }
3435 else {
3436 a_probability2d = new Probabilities::Regions2d;
3437 }
3438 break;
3439 case 3 :
3440 if( a_buffer.m_placement != nullptr ) {
3441 a_probability2d = new(a_buffer.m_placement) Probabilities::Isotropic2d;
3442 a_buffer.incrementPlacement( sizeof( Probabilities::Isotropic2d ) ); }
3443 else {
3444 a_probability2d = new Probabilities::Isotropic2d;
3445 }
3446 break;
3447 case 4 :
3448 if( a_buffer.m_placement != nullptr ) {
3449 a_probability2d = new(a_buffer.m_placement) Probabilities::DiscreteGamma2d;
3450 a_buffer.incrementPlacement( sizeof( Probabilities::DiscreteGamma2d ) ); }
3451 else {
3452 a_probability2d = new Probabilities::DiscreteGamma2d;
3453 }
3454 break;
3455 case 5 :
3456 if( a_buffer.m_placement != nullptr ) {
3457 a_probability2d = new(a_buffer.m_placement) Probabilities::PrimaryGamma2d;
3458 a_buffer.incrementPlacement( sizeof( Probabilities::PrimaryGamma2d ) ); }
3459 else {
3460 a_probability2d = new Probabilities::PrimaryGamma2d;
3461 }
3462 break;
3463 case 6 :
3464 if( a_buffer.m_placement != nullptr ) {
3465 a_probability2d = new(a_buffer.m_placement) Probabilities::Recoil2d;
3466 a_buffer.incrementPlacement( sizeof( Probabilities::Recoil2d ) ); }
3467 else {
3468 a_probability2d = new Probabilities::Recoil2d;
3469 }
3470 break;
3471 case 7 :
3472 if( a_buffer.m_placement != nullptr ) {
3473 a_probability2d = new(a_buffer.m_placement) Probabilities::NBodyPhaseSpace2d;
3475 else {
3476 a_probability2d = new Probabilities::NBodyPhaseSpace2d;
3477 }
3478 break;
3479 case 8 :
3480 if( a_buffer.m_placement != nullptr ) {
3481 a_probability2d = new(a_buffer.m_placement) Probabilities::Evaporation2d;
3482 a_buffer.incrementPlacement( sizeof( Probabilities::Evaporation2d ) ); }
3483 else {
3484 a_probability2d = new Probabilities::Evaporation2d;
3485 }
3486 break;
3487 case 9 :
3488 if( a_buffer.m_placement != nullptr ) {
3489 a_probability2d = new(a_buffer.m_placement) Probabilities::GeneralEvaporation2d;
3491 else {
3492 a_probability2d = new Probabilities::GeneralEvaporation2d;
3493 }
3494 break;
3495 case 10 :
3496 if( a_buffer.m_placement != nullptr ) {
3497 a_probability2d = new(a_buffer.m_placement) Probabilities::SimpleMaxwellianFission2d;
3499 else {
3500 a_probability2d = new Probabilities::SimpleMaxwellianFission2d;
3501 }
3502 break;
3503 case 11 :
3504 if( a_buffer.m_placement != nullptr ) {
3505 a_probability2d = new(a_buffer.m_placement) Probabilities::Watt2d;
3506 a_buffer.incrementPlacement( sizeof( Probabilities::Watt2d ) ); }
3507 else {
3508 a_probability2d = new Probabilities::Watt2d;
3509 }
3510 break;
3511 case 12 :
3512 if( a_buffer.m_placement != nullptr ) {
3513 a_probability2d = new(a_buffer.m_placement) Probabilities::WeightedFunctionals2d;
3515 else {
3516 a_probability2d = new Probabilities::WeightedFunctionals2d;
3517 }
3518 break;
3519 }
3520 }
3521
3522 if( a_mode == LUPI::DataBuffer::Mode::Memory ) {
3523 switch( type ) {
3524 case 0 :
3525 break;
3526 case 1 :
3527 a_buffer.incrementPlacement( sizeof( Probabilities::XYs2d ) );
3528 break;
3529 case 2 :
3530 a_buffer.incrementPlacement( sizeof( Probabilities::Regions2d ) );
3531 break;
3532 case 3 :
3533 a_buffer.incrementPlacement( sizeof( Probabilities::Isotropic2d ) );
3534 break;
3535 case 4 :
3537 break;
3538 case 5 :
3540 break;
3541 case 6 :
3542 a_buffer.incrementPlacement( sizeof( Probabilities::Recoil2d ) );
3543 break;
3544 case 7 :
3546 break;
3547 case 8 :
3549 break;
3550 case 9 :
3552 break;
3553 case 10 :
3555 break;
3556 case 11 :
3557 a_buffer.incrementPlacement( sizeof( Probabilities::Watt2d ) );
3558 break;
3559 case 12 :
3561 break;
3562 }
3563 }
3564
3565 if( a_probability2d != nullptr ) {
3566 switch( type ) {
3567 case 0 :
3568 break;
3569 case 1 :
3570 static_cast<Probabilities::XYs2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3571 break;
3572 case 2 :
3573 static_cast<Probabilities::Regions2d * >( a_probability2d )->serialize( a_buffer, a_mode );
3574 break;
3575 case 3 :
3576 static_cast<Probabilities::Isotropic2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3577 break;
3578 case 4 :
3579 static_cast<Probabilities::DiscreteGamma2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3580 break;
3581 case 5 :
3582 static_cast<Probabilities::PrimaryGamma2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3583 break;
3584 case 6 :
3585 static_cast<Probabilities::Recoil2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3586 break;
3587 case 7 :
3588 static_cast<Probabilities::NBodyPhaseSpace2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3589 break;
3590 case 8 :
3591 static_cast<Probabilities::Evaporation2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3592 break;
3593 case 9 :
3594 static_cast<Probabilities::GeneralEvaporation2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3595 break;
3596 case 10 :
3597 static_cast<Probabilities::SimpleMaxwellianFission2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3598 break;
3599 case 11 :
3600 static_cast<Probabilities::Watt2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3601 break;
3602 case 12 :
3603 static_cast<Probabilities::WeightedFunctionals2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3604 break;
3605 }
3606 }
3607
3608 return( a_probability2d );
3609}
3610
3611/*
3612============================================================
3613*/
3616
3617 int type = 0;
3618
3619 if( a_mode != LUPI::DataBuffer::Mode::Unpack ) {
3620 ProbabilityBase2dType pType = ProbabilityBase2dClass( a_probability2d );
3621
3622 switch( pType ) {
3624 break;
3626 type = 1;
3627 break;
3629 type = 2;
3630 break;
3632 type = 3;
3633 break;
3635 type = 4;
3636 break;
3638 type = 5;
3639 break;
3641 type = 6;
3642 break;
3644 type = 7;
3645 break;
3647 type = 8;
3648 break;
3650 type = 9;
3651 break;
3653 type = 10;
3654 break;
3656 type = 11;
3657 break;
3658 default:
3659 LUPI_THROW( "Probabilities::ProbabilityBase2d_d1: Unsupported ProbabilityBase2d_d1." );
3660 }
3661 }
3662
3663 DATA_MEMBER_INT( type, a_buffer, a_mode );
3664
3665 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
3666 switch( type ) {
3667 case 0 :
3668 a_probability2d = nullptr;
3669 break;
3670 case 1 :
3671 if( a_buffer.m_placement != nullptr ) {
3672 a_probability2d = new(a_buffer.m_placement) Probabilities::XYs2d;
3673 a_buffer.incrementPlacement( sizeof( Probabilities::XYs2d ) ); }
3674 else {
3675 a_probability2d = new Probabilities::XYs2d;
3676 }
3677 break;
3678 case 2 :
3679 if( a_buffer.m_placement != nullptr ) {
3680 a_probability2d = new(a_buffer.m_placement) Probabilities::Regions2d;
3681 a_buffer.incrementPlacement( sizeof( Probabilities::Regions2d ) ); }
3682 else {
3683 a_probability2d = new Probabilities::Regions2d;
3684 }
3685 break;
3686 case 3 :
3687 if( a_buffer.m_placement != nullptr ) {
3688 a_probability2d = new(a_buffer.m_placement) Probabilities::Isotropic2d;
3689 a_buffer.incrementPlacement( sizeof( Probabilities::Isotropic2d ) ); }
3690 else {
3691 a_probability2d = new Probabilities::Isotropic2d;
3692 }
3693 break;
3694 case 4 :
3695 if( a_buffer.m_placement != nullptr ) {
3696 a_probability2d = new(a_buffer.m_placement) Probabilities::DiscreteGamma2d;
3697 a_buffer.incrementPlacement( sizeof( Probabilities::DiscreteGamma2d ) ); }
3698 else {
3699 a_probability2d = new Probabilities::DiscreteGamma2d;
3700 }
3701 break;
3702 case 5 :
3703 if( a_buffer.m_placement != nullptr ) {
3704 a_probability2d = new(a_buffer.m_placement) Probabilities::PrimaryGamma2d;
3705 a_buffer.incrementPlacement( sizeof( Probabilities::PrimaryGamma2d ) ); }
3706 else {
3707 a_probability2d = new Probabilities::PrimaryGamma2d;
3708 }
3709 break;
3710 case 6 :
3711 if( a_buffer.m_placement != nullptr ) {
3712 a_probability2d = new(a_buffer.m_placement) Probabilities::Recoil2d;
3713 a_buffer.incrementPlacement( sizeof( Probabilities::Recoil2d ) ); }
3714 else {
3715 a_probability2d = new Probabilities::Recoil2d;
3716 }
3717 break;
3718 case 7 :
3719 if( a_buffer.m_placement != nullptr ) {
3720 a_probability2d = new(a_buffer.m_placement) Probabilities::NBodyPhaseSpace2d;
3722 else {
3723 a_probability2d = new Probabilities::NBodyPhaseSpace2d;
3724 }
3725 break;
3726 case 8 :
3727 if( a_buffer.m_placement != nullptr ) {
3728 a_probability2d = new(a_buffer.m_placement) Probabilities::Evaporation2d;
3729 a_buffer.incrementPlacement( sizeof( Probabilities::Evaporation2d ) ); }
3730 else {
3731 a_probability2d = new Probabilities::Evaporation2d;
3732 }
3733 break;
3734 case 9 :
3735 if( a_buffer.m_placement != nullptr ) {
3736 a_probability2d = new(a_buffer.m_placement) Probabilities::GeneralEvaporation2d;
3738 else {
3739 a_probability2d = new Probabilities::GeneralEvaporation2d;
3740 }
3741 break;
3742 case 10 :
3743 if( a_buffer.m_placement != nullptr ) {
3744 a_probability2d = new(a_buffer.m_placement) Probabilities::SimpleMaxwellianFission2d;
3746 else {
3747 a_probability2d = new Probabilities::SimpleMaxwellianFission2d;
3748 }
3749 break;
3750 case 11 :
3751 if( a_buffer.m_placement != nullptr ) {
3752 a_probability2d = new(a_buffer.m_placement) Probabilities::Watt2d;
3753 a_buffer.incrementPlacement( sizeof( Probabilities::Watt2d ) ); }
3754 else {
3755 a_probability2d = new Probabilities::Watt2d;
3756 }
3757 break;
3758 }
3759 }
3760
3761 if( a_mode == LUPI::DataBuffer::Mode::Memory ) {
3762 switch( type ) {
3763 case 0 :
3764 break;
3765 case 1 :
3766 a_buffer.incrementPlacement( sizeof( Probabilities::XYs2d ) );
3767 break;
3768 case 2 :
3769 a_buffer.incrementPlacement( sizeof( Probabilities::Regions2d ) );
3770 break;
3771 case 3 :
3772 a_buffer.incrementPlacement( sizeof( Probabilities::Isotropic2d ) );
3773 break;
3774 case 4 :
3776 break;
3777 case 5 :
3779 break;
3780 case 6 :
3781 a_buffer.incrementPlacement( sizeof( Probabilities::Recoil2d ) );
3782 break;
3783 case 7 :
3785 break;
3786 case 8 :
3788 break;
3789 case 9 :
3791 break;
3792 case 10 :
3794 break;
3795 case 11 :
3796 a_buffer.incrementPlacement( sizeof( Probabilities::Watt2d ) );
3797 break;
3798 }
3799 }
3800
3801 if( a_probability2d != nullptr ) {
3802 switch( type ) {
3803 case 0 :
3804 break;
3805 case 1 :
3806 static_cast<Probabilities::XYs2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3807 break;
3808 case 2 :
3809 static_cast<Probabilities::Regions2d * >( a_probability2d )->serialize( a_buffer, a_mode );
3810 break;
3811 case 3 :
3812 static_cast<Probabilities::Isotropic2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3813 break;
3814 case 4 :
3815 static_cast<Probabilities::DiscreteGamma2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3816 break;
3817 case 5 :
3818 static_cast<Probabilities::PrimaryGamma2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3819 break;
3820 case 6 :
3821 static_cast<Probabilities::Recoil2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3822 break;
3823 case 7 :
3824 static_cast<Probabilities::NBodyPhaseSpace2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3825 break;
3826 case 8 :
3827 static_cast<Probabilities::Evaporation2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3828 break;
3829 case 9 :
3830 static_cast<Probabilities::GeneralEvaporation2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3831 break;
3832 case 10 :
3833 static_cast<Probabilities::SimpleMaxwellianFission2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3834 break;
3835 case 11 :
3836 static_cast<Probabilities::Watt2d *>( a_probability2d )->serialize( a_buffer, a_mode );
3837 break;
3838 }
3839 }
3840
3841 return( a_probability2d );
3842}
3843
3844/*
3845============================================================
3846*/
3849
3850 int type = 0;
3851
3852 if( a_mode != LUPI::DataBuffer::Mode::Unpack ) {
3853 ProbabilityBase2dType pType = ProbabilityBase2dClass( a_probability2d );
3854
3855 switch( pType ) {
3857 break;
3859 type = 1;
3860 break;
3862 type = 3;
3863 break;
3865 type = 4;
3866 break;
3868 type = 5;
3869 break;
3871 type = 6;
3872 break;
3874 type = 7;
3875 break;
3877 type = 8;
3878 break;
3880 type = 9;
3881 break;
3883 type = 10;
3884 break;
3886 type = 11;
3887 break;
3888 default:
3889 LUPI_THROW( "Probabilities::ProbabilityBase2d_d1: Unsupported ProbabilityBase2d_d2" );
3890 }
3891 }
3892
3893 DATA_MEMBER_INT( type, a_buffer, a_mode );
3894
3895 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
3896 switch( type ) {
3897 case 0 :
3898 a_probability2d = nullptr;
3899 break;
3900 case 1 :
3901 if( a_buffer.m_placement != nullptr ) {
3902 a_probability2d = new(a_buffer.m_placement) Probabilities::XYs2d;
3903 a_buffer.incrementPlacement( sizeof( Probabilities::XYs2d ) ); }
3904 else {
3905 a_probability2d = new Probabilities::XYs2d;
3906 }
3907 break;
3908 case 3 :
3909 if( a_buffer.m_placement != nullptr ) {
3910 a_probability2d = new(a_buffer.m_placement) Probabilities::Isotropic2d;
3911 a_buffer.incrementPlacement( sizeof( Probabilities::Isotropic2d ) ); }
3912 else {
3913 a_probability2d = new Probabilities::Isotropic2d;
3914 }
3915 break;
3916 case 4 :
3917 if( a_buffer.m_placement != nullptr ) {
3918 a_probability2d = new(a_buffer.m_placement) Probabilities::DiscreteGamma2d;
3919 a_buffer.incrementPlacement( sizeof( Probabilities::DiscreteGamma2d ) ); }
3920 else {
3921 a_probability2d = new Probabilities::DiscreteGamma2d;
3922 }
3923 break;
3924 case 5 :
3925 if( a_buffer.m_placement != nullptr ) {
3926 a_probability2d = new(a_buffer.m_placement) Probabilities::PrimaryGamma2d;
3927 a_buffer.incrementPlacement( sizeof( Probabilities::PrimaryGamma2d ) ); }
3928 else {
3929 a_probability2d = new Probabilities::PrimaryGamma2d;
3930 }
3931 break;
3932 case 6 :
3933 if( a_buffer.m_placement != nullptr ) {
3934 a_probability2d = new(a_buffer.m_placement) Probabilities::Recoil2d;
3935 a_buffer.incrementPlacement( sizeof( Probabilities::Recoil2d ) ); }
3936 else {
3937 a_probability2d = new Probabilities::Recoil2d;
3938 }
3939 break;
3940 case 7 :
3941 if( a_buffer.m_placement != nullptr ) {
3942 a_probability2d = new(a_buffer.m_placement) Probabilities::NBodyPhaseSpace2d;
3944 else {
3945 a_probability2d = new Probabilities::NBodyPhaseSpace2d;
3946 }
3947 break;
3948 case 8 :
3949 if( a_buffer.m_placement != nullptr ) {
3950 a_probability2d = new(a_buffer.m_placement) Probabilities::Evaporation2d;
3951 a_buffer.incrementPlacement( sizeof( Probabilities::Evaporation2d ) ); }
3952 else {
3953 a_probability2d = new Probabilities::Evaporation2d;
3954 }
3955 break;
3956 case 9 :
3957 if( a_buffer.m_placement != nullptr ) {
3958 a_probability2d = new(a_buffer.m_placement) Probabilities::GeneralEvaporation2d;
3960 else {
3961 a_probability2d = new Probabilities::GeneralEvaporation2d;
3962 }
3963 break;
3964 case 10 :
3965 if( a_buffer.m_placement != nullptr ) {
3966 a_probability2d = new(a_buffer.m_placement) Probabilities::SimpleMaxwellianFission2d;
3968 else {
3969 a_probability2d = new Probabilities::SimpleMaxwellianFission2d;
3970 }
3971 break;
3972 case 11 :
3973 if( a_buffer.m_placement != nullptr ) {
3974 a_probability2d = new(a_buffer.m_placement) Probabilities::Watt2d;
3975 a_buffer.incrementPlacement( sizeof( Probabilities::Watt2d ) ); }
3976 else {
3977 a_probability2d = new Probabilities::Watt2d;
3978 }
3979 break;
3980 }
3981 }
3982
3983 if( a_mode == LUPI::DataBuffer::Mode::Memory ) {
3984 switch( type ) {
3985 case 0 :
3986 break;
3987 case 1 :
3988 a_buffer.incrementPlacement( sizeof( Probabilities::XYs2d ) );
3989 break;
3990 case 3 :
3991 a_buffer.incrementPlacement( sizeof( Probabilities::Isotropic2d ) );
3992 break;
3993 case 4 :
3995 break;
3996 case 5 :
3998 break;
3999 case 6 :
4000 a_buffer.incrementPlacement( sizeof( Probabilities::Recoil2d ) );
4001 break;
4002 case 7 :
4004 break;
4005 case 8 :
4007 break;
4008 case 9 :
4010 break;
4011 case 10 :
4013 break;
4014 case 11 :
4015 a_buffer.incrementPlacement( sizeof( Probabilities::Watt2d ) );
4016 break;
4017 }
4018 }
4019
4020 if( a_probability2d != nullptr ) {
4021 switch( type ) {
4022 case 0 :
4023 break;
4024 case 1 :
4025 static_cast<Probabilities::XYs2d *>( a_probability2d )->serialize( a_buffer, a_mode );
4026 break;
4027 case 3 :
4028 static_cast<Probabilities::Isotropic2d *>( a_probability2d )->serialize( a_buffer, a_mode );
4029 break;
4030 case 4 :
4031 static_cast<Probabilities::DiscreteGamma2d *>( a_probability2d )->serialize( a_buffer, a_mode );
4032 break;
4033 case 5 :
4034 static_cast<Probabilities::PrimaryGamma2d *>( a_probability2d )->serialize( a_buffer, a_mode );
4035 break;
4036 case 6 :
4037 static_cast<Probabilities::Recoil2d *>( a_probability2d )->serialize( a_buffer, a_mode );
4038 break;
4039 case 7 :
4040 static_cast<Probabilities::NBodyPhaseSpace2d *>( a_probability2d )->serialize( a_buffer, a_mode );
4041 break;
4042 case 8 :
4043 static_cast<Probabilities::Evaporation2d *>( a_probability2d )->serialize( a_buffer, a_mode );
4044 break;
4045 case 9 :
4046 static_cast<Probabilities::GeneralEvaporation2d *>( a_probability2d )->serialize( a_buffer, a_mode );
4047 break;
4048 case 10 :
4049 static_cast<Probabilities::SimpleMaxwellianFission2d *>( a_probability2d )->serialize( a_buffer, a_mode );
4050 break;
4051 case 11 :
4052 static_cast<Probabilities::Watt2d *>( a_probability2d )->serialize( a_buffer, a_mode );
4053 break;
4054 }
4055 }
4056
4057 return( a_probability2d );
4058}
4059
4060/*
4061============================================================
4062*/
4064
4065 if( a_function == nullptr ) return( ProbabilityBase3dType::none );
4066 return( a_function->type( ) );
4067}
4068
4069/*
4070============================================================
4071*/
4073
4074 int type = 0;
4075
4076 if( a_mode != LUPI::DataBuffer::Mode::Unpack ) {
4077 ProbabilityBase3dType pType = ProbabilityBase3dClass( a_probability3d );
4078
4079 switch( pType ) {
4081 break;
4083 type = 1;
4084 break;
4085 }
4086 }
4087
4088 DATA_MEMBER_INT( type, a_buffer, a_mode );
4089
4090 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
4091 switch( type ) {
4092 case 0 :
4093 a_probability3d = nullptr;
4094 break;
4095 case 1 :
4096 if( a_buffer.m_placement != nullptr ) {
4097 a_probability3d = new(a_buffer.m_placement) Probabilities::XYs3d;
4098 a_buffer.incrementPlacement( sizeof( Probabilities::XYs3d ) ); }
4099 else {
4100 a_probability3d = new Probabilities::XYs3d;
4101 }
4102 break;
4103 }
4104 }
4105 if( a_mode == LUPI::DataBuffer::Mode::Memory ) {
4106 switch( type ) {
4107 case 0 :
4108 break;
4109 case 1 :
4110 a_buffer.incrementPlacement( sizeof( Probabilities::XYs3d ) );
4111 break;
4112 }
4113 }
4114
4115 if( a_probability3d != nullptr ) {
4116 switch( type ) {
4117 case 0 :
4118 break;
4119 case 1 :
4120 static_cast<Probabilities::XYs3d *>( a_probability3d )->serialize( a_buffer, a_mode );
4121 break;
4122 }
4123 }
4124
4125 return( a_probability3d );
4126}
4127
4128} // End of namespace MCGIDI.
G4double Y(G4double density)
#define DATA_MEMBER_STRING(member, buf, mode)
#define DATA_MEMBER_VECTOR_DOUBLE(member, buf, mode)
#define DATA_MEMBER_DOUBLE(member, buf, mode)
#define DATA_MEMBER_INT( member, buf, mode)
#define LUPI_HOST_DEVICE
#define LUPI_THROW(arg)
#define LUPI_HOST
#define LUPI_maybeUnused
#define PoPI_AMU2MeV_c2
Definition PoPI.hpp:30
#define M_PI
Definition SbMath.h:33
FormType type() const
Definition GIDI.hpp:667
std::string const & initialState() const
Definition GIDI.hpp:1369
Vector const & grid() const
Definition GIDI.hpp:1253
Vector const & data() const
Definition GIDI.hpp:1254
std::vector< double > const & coefficients() const
Definition GIDI.hpp:1197
std::string const & finalState() const
Definition GIDI.hpp:1653
std::size_t size() const
Definition GIDI.hpp:1335
std::vector< Function2dForm * > const & function2ds() const
Definition GIDI.hpp:1881
std::vector< Weighted_function2d * > const & weighted_function2d() const
Definition GIDI.hpp:1831
std::size_t size() const
Definition GIDI.hpp:1100
std::vector< Function1dForm * > const & function1ds() const
Definition GIDI.hpp:1560
std::vector< Function2dForm * > const & function2ds() const
Definition GIDI.hpp:1951
Styles::Suite & styles()
Definition GIDI.hpp:4802
std::vector< Base const * > const & preProcessingChainEnds() const
Definition GIDI.hpp:3405
T * getViaLineage(std::string const &a_label)
Definition GIDI.hpp:3447
bool has(std::string const &a_label) const
Definition GIDI.hpp:2616
T * get(std::size_t a_Index)
Definition GIDI.hpp:2642
void resize(std::size_t a_number, double a_value=0.0)
Definition GIDI_data.hpp:80
std::string const & moniker() const
Definition GUPI.hpp:102
std::string toXLink() const
LUPI_HOST_DEVICE void incrementPlacement(std::size_t a_delta)
LUPI_HOST_DEVICE double evaluate(double a_x1) const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE double evaluate(double a_x1) const
LUPI_HOST_DEVICE double evaluate(double a_x1) const
LUPI_HOST_DEVICE String typeString() const
LUPI_HOST_DEVICE Function1dType type() const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double evaluate(double a_x1) const MCGIDI_TRUE_VIRTUAL
LUPI_HOST_DEVICE Function2dType type() const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE String typeString() const
LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double evaluate(double a_x2, double a_x1) const MCGIDI_TRUE_VIRTUAL
LUPI_HOST_DEVICE double domainMin() const
LUPI_HOST_DEVICE Interpolation interpolation() const
virtual LUPI_HOST_DEVICE ~FunctionBase()=0
LUPI_HOST_DEVICE double domainMax() const
LUPI_HOST_DEVICE double outerDomainValue() const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE double evaluate(double a_x1) const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE double evaluate(double a_x1) const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE void append(Function1d_d2 *a_function1d)
LUPI_HOST_DEVICE double evaluate(double a_x1) const
LUPI_HOST_DEVICE double evaluate(double a_energy) const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE double evaluate(double a_x1) const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE double evaluate(double a_x2, double a_x1) const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE double evaluate(double a_x2, double a_x1) const
LUPI_HOST_DEVICE double evaluate(double a_x2, double a_x1) const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE double evaluate(double a_x2, double a_x1) const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE double evaluate(double a_x2, double a_x1) const
LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double evaluate(double a_x1) const MCGIDI_TRUE_VIRTUAL
LUPI_HOST_DEVICE String typeString() const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE ProbabilityBase1dType type() const
LUPI_HOST_DEVICE double evaluate(double a_x2, double a_x1) const
LUPI_HOST_DEVICE double evaluate(double a_x2, double a_x1) const
LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double evaluate(double a_x2, double a_x1) const MCGIDI_TRUE_VIRTUAL
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE String typeString() const
LUPI_HOST_DEVICE ProbabilityBase2dType type() const
LUPI_HOST_DEVICE ProbabilityBase3dType type() const
LUPI_HOST_DEVICE String typeString() const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double evaluate(double a_x3, double a_x2, double a_x1) const MCGIDI_TRUE_VIRTUAL
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE double evaluate(double a_x2, double a_x1) const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE double evaluate(double a_x2, double a_x1) const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE double evaluate(double a_x2, double a_x1) const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE double evaluate(double a_x2, double a_x1) const
LUPI_HOST_DEVICE double evaluate(double a_x2, double a_x1) const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE double evaluate(double a_x2, double a_x1) const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE double evaluate(double a_x3, double a_x2, double a_x1) const
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE double evaluate(double a_x1) const
GIDI::ProtareSingle const & m_GIDI_protare
Definition MCGIDI.hpp:255
std::map< std::string, int > m_stateNamesToIndices
Definition MCGIDI.hpp:277
bool m_hasFinalStatePhotons
Definition MCGIDI.hpp:275
LUPI_HOST_DEVICE const char * c_str() const
raw data
LUPI_HOST_DEVICE std::size_t size() const
FormType
Definition GIDI.hpp:118
@ weightedFunctionals2d
Definition GIDI.hpp:129
@ simpleMaxwellianFission2d
Definition GIDI.hpp:128
@ generalEvaporation2d
Definition GIDI.hpp:128
@ NBodyPhaseSpace2d
Definition GIDI.hpp:129
LUPI_HOST Function1d_d1 * parseFunction1d_d1(Transporting::MC const &a_settings, GIDI::Suite const &a_suite)
LUPI_HOST Function2d * parseFunction2d(Transporting::MC const &a_settings, GIDI::Suite const &a_suite)
LUPI_HOST Function1d * parseMultiplicityFunction1d(SetupInfo &a_setupInfo, Transporting::MC const &a_settings, GIDI::Suite const &a_suite)
LUPI_HOST Function1d_d2 * parseFunction1d_d2(GIDI::Functions::Function1dForm const *form1d)
LUPI_HOST ProbabilityBase2d_d2 * parseProbability2d_d2(GIDI::Functions::Function2dForm const *form2d, SetupInfo *a_setupInfo)
LUPI_HOST ProbabilityBase3d * parseProbability3d(Transporting::MC const &a_settings, GIDI::Suite const &a_suite)
LUPI_HOST ProbabilityBase2d_d1 * parseProbability2d_d1(GIDI::Functions::Function2dForm const *form2d, SetupInfo *a_setupInfo)
LUPI_HOST ProbabilityBase1d * parseProbability1d(Transporting::MC const &a_settings, GIDI::Suite const &a_suite)
LUPI_HOST ProbabilityBase2d * parseProbability2d(Transporting::MC const &a_settings, GIDI::Suite const &a_suite, SetupInfo *a_setupInfo)
Simple C++ string class, useful as replacement for std::string if this cannot be used,...
Definition MCGIDI.hpp:43
LUPI_HOST_DEVICE Function2dType Function2dClass(Functions::Function2d *funct)
LUPI_HOST_DEVICE Probabilities::ProbabilityBase2d * serializeProbability2d(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, Probabilities::ProbabilityBase2d *a_probability2d)
LUPI_HOST_DEVICE Functions::Function2d * serializeFunction2d(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, Functions::Function2d *a_function2d)
LUPI_HOST_DEVICE ProbabilityBase1dType ProbabilityBase1dClass(Probabilities::ProbabilityBase1d *funct)
LUPI_HOST_DEVICE Probabilities::ProbabilityBase2d_d1 * serializeProbability2d_d1(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, Probabilities::ProbabilityBase2d_d1 *a_probability2d)
LUPI_HOST_DEVICE Function1dType Function1dClass(Functions::Function1d *funct)
LUPI_HOST_DEVICE Probabilities::ProbabilityBase3d * serializeProbability3d(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, Probabilities::ProbabilityBase3d *a_probability3d)
LUPI_HOST_DEVICE Interpolation GIDI2MCGIDI_interpolation(ptwXY_interpolation a_interpolation)
LUPI_HOST_DEVICE Probabilities::ProbabilityBase2d_d2 * serializeProbability2d_d2(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, Probabilities::ProbabilityBase2d_d2 *a_probability2d)
LUPI_HOST_DEVICE Functions::Function1d_d2 * serializeFunction1d_d2(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, Functions::Function1d_d2 *a_function1d)
LUPI_HOST_DEVICE Functions::Function1d * serializeFunction1d(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, Functions::Function1d *a_function1d)
LUPI_HOST_DEVICE int binarySearchVector(double a_x, Vector< double > const &a_Xs, bool a_boundIndex=false)
Definition MCGIDI.hpp:318
LUPI_HOST_DEVICE ProbabilityBase3dType ProbabilityBase3dClass(Probabilities::ProbabilityBase3d *funct)
LUPI_HOST_DEVICE ProbabilityBase2dType ProbabilityBase2dClass(Probabilities::ProbabilityBase2d *funct)
LUPI_HOST_DEVICE Functions::Function1d_d1 * serializeFunction1d_d1(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, Functions::Function1d_d1 *a_function1d)
LUPI_HOST_DEVICE Probabilities::ProbabilityBase1d * serializeProbability1d(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, Probabilities::ProbabilityBase1d *a_probability1d)
@ nfu_Okay
enum nfu_status_e nfu_status
ptwXPoints * ptwXY_runningIntegral(statusMessageReporting *smr, ptwXYPoints *ptwXY)
ptwXYPoints * ptwXY_createFromFunction(statusMessageReporting *smr, int n, double *xs, ptwXY_createFromFunction_callback func, void *argList, double accuracy, int checkForRoots, int biSectionMax)
Definition ptwXY_misc.c:46
enum ptwXY_interpolation_e ptwXY_interpolation
@ ptwXY_interpolationFlat
Definition ptwXY.h:38
@ ptwXY_interpolationLinLog
Definition ptwXY.h:37
@ ptwXY_interpolationLogLog
Definition ptwXY.h:38
@ ptwXY_interpolationLinLin
Definition ptwXY.h:37
@ ptwXY_interpolationLogLin
Definition ptwXY.h:37
struct ptwXYPoints_s ptwXYPoints
int64_t ptwXY_length(statusMessageReporting *smr, ptwXYPoints *ptwXY)
Definition ptwXY_core.c:793
struct ptwXYPoint_s ptwXYPoint
ptwXYPoints * ptwXY_free(ptwXYPoints *ptwXY)
Definition ptwXY_core.c:782
ptwXYPoint * ptwXY_getPointAtIndex_Unsafely(ptwXYPoints const *ptwXY, int64_t index)
double ptwX_getPointAtIndex_Unsafely(ptwXPoints *ptwX, int64_t index)
Definition ptwX_core.c:297
struct ptwXPoints_s ptwXPoints
ptwXPoints * ptwX_free(ptwXPoints *ptwX)
Definition ptwX_core.c:213
double y
Definition ptwXY.h:64
double x
Definition ptwXY.h:64