@@ -58,7 +58,7 @@ class InternalStorageUnitOpRecorder : public ISolutionRecorder
5858 InternalStorageUnitOpRecorder (UnitOpIdx idx) : _cfgSolution({false , false , false , true , false , false , false }),
5959 _cfgSolutionDot ({false , false , false , false , false , false , false }), _cfgSensitivity({false , false , false , true , false , false , false }),
6060 _cfgSensitivityDot ({false , false , false , true , false , false , false }), _storeTime(false ), _storeCoordinates(false ), _splitComponents(true ), _splitPorts(true ),
61- _singleAsMultiPortUnitOps (false ), _keepBulkSingletonDim(true ), _keepParticleSingletonDim( true ), _curCfg(nullptr ), _nComp(0 ), _nVolumeDof(0 ), _nAxialCells(0 ), _nRadialCells(0 ),
61+ _singleAsMultiPortUnitOps (false ), _keepBulkSingletonDim(true ), _curCfg(nullptr ), _nComp(0 ), _nVolumeDof(0 ), _nAxialCells(0 ), _nRadialCells(0 ),
6262 _nInletPorts (0 ), _nOutletPorts(0 ), _numTimesteps(0 ), _numSens(0 ), _unitOp(idx), _needsReAlloc(false ), _axialCoords(0 ), _radialCoords(0 ), _particleCoords(0 )
6363 {
6464 }
@@ -125,19 +125,20 @@ class InternalStorageUnitOpRecorder : public ISolutionRecorder
125125 _nOutletPorts = exporter.numOutletPorts ();
126126
127127 _keepBulkSingletonDim = exporter.hasPrimaryExtent ();
128- _keepParticleSingletonDim = !exporter.isParticleLumped ();
129128
130129 _nAxialCells = exporter.numPrimaryCoordinates ();
131130 _nRadialCells = exporter.numSecondaryCoordinates ();
132131
133132 // Query particle type specific structure
134133 const unsigned int numParTypes = exporter.numParticleTypes ();
134+ _keepParticleSingletonDim.resize (numParTypes, 0u );
135135 _nParShells.resize (numParTypes, 0u );
136136 _nBoundStates.resize (numParTypes, 0u );
137137 for (unsigned int i = 0 ; i < numParTypes; ++i)
138138 {
139139 _nParShells[i] = exporter.numParticleShells (i);
140140 _nBoundStates[i] = exporter.numBoundStates (i);
141+ _keepParticleSingletonDim[i] = !exporter.isParticleLumped (i);
141142 }
142143
143144 // Obtain coordinates
@@ -350,7 +351,7 @@ class InternalStorageUnitOpRecorder : public ISolutionRecorder
350351 unsigned int offset = 0 ;
351352 for (std::size_t pt = 0 ; pt < _nParShells.size (); ++pt)
352353 {
353- if (_nParShells[pt] == 0 || (!_keepParticleSingletonDim && (_nParShells[pt] == 1 )))
354+ if (_nParShells[pt] == 0 || (!_keepParticleSingletonDim[pt] && (_nParShells[pt] == 1 )))
354355 continue ;
355356
356357 oss.str (" " );
@@ -449,10 +450,10 @@ class InternalStorageUnitOpRecorder : public ISolutionRecorder
449450 inline void treatSingleAsMultiPortUnitOps (bool smp) CADET_NOEXCEPT { _singleAsMultiPortUnitOps = smp; }
450451
451452 inline bool keepBulkSingletonDim () const CADET_NOEXCEPT { return _keepBulkSingletonDim; }
452- inline void keepBulkSingletonDim (bool keepSingleton) CADET_NOEXCEPT { _keepBulkSingletonDim = keepSingleton; }
453+ inline void setKeepBulkSingletonDim (bool keepSingleton) CADET_NOEXCEPT { _keepBulkSingletonDim = keepSingleton; }
453454
454- inline bool keepParticleSingletonDim () const CADET_NOEXCEPT { return _keepParticleSingletonDim; }
455- inline void keepParticleSingletonDim (bool keepSingleton) CADET_NOEXCEPT { _keepParticleSingletonDim = keepSingleton; }
455+ inline bool keepParticleSingletonDim (unsigned int parType ) const CADET_NOEXCEPT { return _keepParticleSingletonDim[parType] ; }
456+ inline void setKeepParticleSingletonDim (bool keepSingleton) CADET_NOEXCEPT { std::fill ( _keepParticleSingletonDim. begin (), _keepParticleSingletonDim. end (), keepSingleton) ; }
456457
457458 inline UnitOpIdx unitOperation () const CADET_NOEXCEPT { return _unitOp; }
458459 inline void unitOperation (UnitOpIdx idx) CADET_NOEXCEPT { _unitOp = idx; }
@@ -754,7 +755,7 @@ class InternalStorageUnitOpRecorder : public ISolutionRecorder
754755 {
755756 if (_nParShells[0 ] >= 1 )
756757 {
757- if ((_nParShells[0 ] == 1 ) && _keepParticleSingletonDim)
758+ if ((_nParShells[0 ] == 1 ) && _keepParticleSingletonDim[ 0 ] )
758759 layout.push_back (_nParShells[0 ]);
759760 else if (_nParShells[0 ] > 1 )
760761 layout.push_back (_nParShells[0 ]);
@@ -779,12 +780,12 @@ class InternalStorageUnitOpRecorder : public ISolutionRecorder
779780 std::size_t layoutSize = layout.size ();
780781 if (hasParticleShells)
781782 {
782- if ((_nParShells[parType] == 1 ) && !_keepParticleSingletonDim)
783+ if ((_nParShells[parType] == 1 ) && !_keepParticleSingletonDim[parType] )
783784 {
784785 layout[layoutSize - 2 ] = _nComp;
785786 --layoutSize;
786787 }
787- else if ((_nParShells[parType] == 1 ) && _keepParticleSingletonDim)
788+ else if ((_nParShells[parType] == 1 ) && _keepParticleSingletonDim[parType] )
788789 layout[layout.size () - 2 ] = _nParShells[parType];
789790 else if (_nParShells[parType] > 1 )
790791 layout[layout.size () - 2 ] = _nParShells[parType];
@@ -814,7 +815,7 @@ class InternalStorageUnitOpRecorder : public ISolutionRecorder
814815 {
815816 if (_nParShells[0 ] >= 1 )
816817 {
817- if ((_nParShells[0 ] == 1 ) && _keepParticleSingletonDim)
818+ if ((_nParShells[0 ] == 1 ) && _keepParticleSingletonDim[ 0 ] )
818819 layout.push_back (_nParShells[0 ]);
819820 else if (_nParShells[0 ] > 1 )
820821 layout.push_back (_nParShells[0 ]);
@@ -839,9 +840,9 @@ class InternalStorageUnitOpRecorder : public ISolutionRecorder
839840 std::size_t layoutSize = layout.size ();
840841 if (hasParticleShells)
841842 {
842- if ((_nParShells[parType] == 1 ) && !_keepParticleSingletonDim)
843+ if ((_nParShells[parType] == 1 ) && !_keepParticleSingletonDim[ 0 ] )
843844 --layoutSize;
844- else if ((_nParShells[parType] == 1 ) && _keepParticleSingletonDim)
845+ else if ((_nParShells[parType] == 1 ) && _keepParticleSingletonDim[ 0 ] )
845846 layout[layout.size () - 2 ] = _nParShells[parType];
846847 else if (_nParShells[parType] > 1 )
847848 layout[layout.size () - 2 ] = _nParShells[parType];
@@ -934,7 +935,7 @@ class InternalStorageUnitOpRecorder : public ISolutionRecorder
934935 bool _splitPorts;
935936 bool _singleAsMultiPortUnitOps;
936937 bool _keepBulkSingletonDim;
937- bool _keepParticleSingletonDim;
938+ std::vector< bool > _keepParticleSingletonDim;
938939
939940 StorageConfig const * _curCfg;
940941 Storage* _curStorage;
0 commit comments