File indexing completed on 2026-04-09 07:49:30
0001 #pragma once
0002
0003 #include <string>
0004 #include <sstream>
0005 #include <iomanip>
0006 #include <cassert>
0007
0008 #include "SYSRAP_API_EXPORT.hh"
0009
0010
0011 struct SYSRAP_API sbb
0012 {
0013 static constexpr const char* NAME = "sbb" ;
0014 static constexpr const int N = 6 ;
0015 static bool IsZero( const double* v );
0016
0017 double x0, y0, z0, x1, y1, z1 ;
0018
0019 double* data() { return &x0 ; }
0020 const double* cdata() const { return &x0 ; }
0021 double zmin() const { return z0 ; }
0022 double zmax() const { return z1 ; }
0023
0024 void increase_zmax(double dz) { assert( dz >= 0. ) ; z1 += dz ; }
0025 void decrease_zmin(double dz) { assert( dz >= 0. ) ; z0 -= dz ; }
0026
0027 std::string desc() const ;
0028 static std::string Desc(const double* d);
0029 };
0030
0031 inline bool sbb::IsZero( const double* v )
0032 {
0033 int count = 0 ;
0034 for(int i=0 ; i < N ; i++) if(v[i] == 0.) count += 1 ;
0035 return count == N ;
0036 }
0037
0038 inline std::string sbb::desc() const
0039 {
0040 const double* v = cdata() ;
0041 return Desc(v) ;
0042 }
0043
0044 inline std::string sbb::Desc(const double* v)
0045 {
0046 int wid = 8 ;
0047 int pre = 3 ;
0048 std::stringstream ss ;
0049 ss << "(" ;
0050 for(int i=0 ; i < 6 ; i++) ss << std::setw(wid) << std::fixed << std::setprecision(pre) << v[i] << " " ;
0051 ss << ")" ;
0052 std::string str = ss.str();
0053 return str ;
0054 }
0055
0056