Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions CSG/CSGFoundry.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include <iostream>
#include <iomanip>
#include <array>
Expand All @@ -19,7 +19,6 @@

#include "smeta.h"
#include "SSim.hh"
#include "SStr.hh"

// TODO: migrate to spath.h
#include "SPath.hh"
Expand Down Expand Up @@ -1152,7 +1151,7 @@
std::vector<unsigned>& ss = solid_idx ;

std::vector<std::string> elem ;
SStr::Split(label, ',', elem );
sstr::Split(label, ',', elem );

for(unsigned i=0 ; i < elem.size() ; i++)
{
Expand All @@ -1161,7 +1160,7 @@
{
const CSGSolid& so = solid[j];

bool match = SStr::SimpleMatch(so.label, ele.c_str()) ;
bool match = sstr::SimpleMatch(so.label, ele.c_str()) ;
unsigned count = std::count(ss.begin(), ss.end(), j ); // count if j is already collected
if(match && count == 0) ss.push_back(j) ;
}
Expand Down Expand Up @@ -1318,14 +1317,18 @@
float4 ce = pr->ce();

std::stringstream ss ;
auto label_value = [](const char* label, int value)
{
return sstr::Format_("%s:%d", label, value);
};
ss
<< std::setw(10) << SStr::Format(" pri:%d", primIdx )
<< std::setw(10) << SStr::Format(" lpr:%d", pr_primIdx )
<< std::setw(8) << SStr::Format(" gas:%d", gasIdx )
<< std::setw(8) << SStr::Format(" msh:%d", meshIdx)
<< std::setw(8) << SStr::Format(" bnd:%d", boundary)
<< std::setw(8) << SStr::Format(" nno:%d", numNode )
<< std::setw(10) << SStr::Format(" nod:%d", nodeOffset )
<< std::setw(10) << label_value("pri", primIdx)
<< std::setw(10) << label_value("lpr", pr_primIdx)
<< std::setw(8) << label_value("gas", gasIdx)
<< std::setw(8) << label_value("msh", meshIdx)
<< std::setw(8) << label_value("bnd", boundary)
<< std::setw(8) << label_value("nno", numNode)
<< std::setw(10) << label_value("nod", nodeOffset)
<< " ce "
<< "(" << std::setw(10) << std::fixed << std::setprecision(2) << ce.x
<< "," << std::setw(10) << std::fixed << std::setprecision(2) << ce.y
Expand Down Expand Up @@ -4033,4 +4036,3 @@




5 changes: 2 additions & 3 deletions CSG/tests/CSGFoundry_getCenterExtent_Test.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/**
CSGFoundry_getCenterExtent_Test.cc
====================================
Expand All @@ -22,7 +22,7 @@

#include <csignal>
#include "SSys.hh"
#include "SStr.hh"
#include "sstr.h"
#include "SSim.hh"
#include "CSGFoundry.h"

Expand All @@ -42,7 +42,7 @@

const char* MOI = SSys::getenvvar("MOI", "sWorld:0:0");
std::vector<std::string> vmoi ;
SStr::Split(MOI, ',', vmoi );
sstr::Split(MOI, ',', vmoi );
LOG(info) << " MOI " << MOI << " vmoi.size " << vmoi.size() ;

qat4 q ;
Expand Down Expand Up @@ -77,4 +77,3 @@




16 changes: 13 additions & 3 deletions CSG/tests/CSGNodeScanTest.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/**
CSGNodeScanTest.cc
=====================
Expand All @@ -15,7 +15,7 @@

#include "OPTICKS_LOG.hh"
#include "SSys.hh"
#include "SStr.hh"
#include "sstr.h"
#include "SPath.hh"
#include "NP.hh"

Expand All @@ -28,6 +28,16 @@
#include "csg_intersect_node.h"
#include "csg_intersect_tree.h"

namespace
{
std::vector<int>* ParseIntList(const char* spec, char delim)
{
auto* values = new std::vector<int>();
if(spec) sstr::split<int>(*values, spec, delim);
return values;
}
}

struct Scan
{
const char* geom ;
Expand Down Expand Up @@ -59,8 +69,8 @@
shifted(true),
modes_(SSys::getenvvar("MODES", "0,1,2,3")),
axes_(SSys::getenvvar("AXES", "0,2,1")), // X,Z,Y 3rd gets set to zero
modes(SStr::ISplit(modes_, ',')),
axes(SStr::ISplit(axes_, ',')),
modes(ParseIntList(modes_, ',')),
axes(ParseIntList(axes_, ',')),
simtrace(NP::Make<float>(modes->size(),num,4,4)),
qq((quad4*)simtrace->values<float>()),
fold(SPath::Resolve("$TMP/CSGNodeScanTest", geom, DIRPATH ))
Expand Down
2 changes: 0 additions & 2 deletions CSG/tests/CSGTargetGlobalTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ MOI=solidXJfixture:64 CSGTargetGlobalTest
#include "SPath.hh"
#include "SSys.hh"
#include "SSim.hh"
#include "SStr.hh"
#include "OPTICKS_LOG.hh"

#include "scuda.h"
Expand Down Expand Up @@ -93,4 +92,3 @@ int main(int argc, char** argv)
}



5 changes: 2 additions & 3 deletions CSG/tests/CSGTargetTest.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/**
CSGTargetTest
==============
Expand Down Expand Up @@ -26,7 +26,7 @@
**/
#include <csignal>
#include "SSys.hh"
#include "SStr.hh"
#include "sstr.h"
#include "SSim.hh"

#include "OPTICKS_LOG.hh"
Expand Down Expand Up @@ -70,7 +70,7 @@
void CSGTargetTest::dumpMOI( const char* MOI )
{
std::vector<std::string> vmoi ;
SStr::Split(MOI, ',', vmoi );
sstr::Split(MOI, ',', vmoi );

LOG(info) << " MOI " << MOI << " vmoi.size " << vmoi.size() ;

Expand Down Expand Up @@ -201,4 +201,3 @@
}



25 changes: 19 additions & 6 deletions CSG/tests/DemoGeo.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#include <iostream>
#include <iomanip>
#include <cstring>
#include <array>
#include <algorithm>


//#include <vector_types.h>

#include "SStr.hh"
#include "sstr.h"
#include "ssys.h"
#include "NP.hh"
#include "SLOG.hh"
Expand All @@ -19,6 +20,19 @@
#include "DemoGeo.h"
#include "DemoGrid.h"

namespace
{
void ParseGridSpec(std::array<int,9>& grid, const char* spec)
{
std::vector<int> values;
std::stringstream ss(spec ? spec : "");
std::string item;
while(std::getline(ss, item, ',')) sstr::split<int>(values, item.c_str(), ':');
assert(values.size() == grid.size());
std::copy(values.begin(), values.end(), grid.begin());
}
}

DemoGeo::DemoGeo(CSGFoundry* foundry_, const char* geom)
:
foundry(foundry_),
Expand All @@ -45,15 +59,15 @@
{
init_parade();
}
else if(SStr::StartsWith(geom, "clustered_"))
else if(sstr::StartsWith(geom, "clustered_"))
{
init_clustered( geom + strlen("clustered_"));
}
else if(SStr::StartsWith(geom, "scaled_"))
else if(sstr::StartsWith(geom, "scaled_"))
{
init_scaled( geom, geom + strlen("scaled_"), outer, layers, numgas );
}
else if(SStr::StartsWith(geom, "layered_"))
else if(sstr::StartsWith(geom, "layered_"))
{
init_layered( geom + strlen("layered_"), outer, layers );
}
Expand Down Expand Up @@ -142,7 +156,7 @@

bool inbox = false ;
std::array<int,9> cl ;
SStr::ParseGridSpec(cl, clusterspec); // string parsed into array of 9 ints
ParseGridSpec(cl, clusterspec);
CSGSolid* so = maker->makeClustered(name, cl[0],cl[1],cl[2],cl[3],cl[4],cl[5],cl[6],cl[7],cl[8], unit, inbox );
std::cout << "DemoGeo::init_layered" << name << " so.center_extent " << so->center_extent << std::endl ;

Expand Down Expand Up @@ -218,4 +232,3 @@
std::string s = ss.str();
return s ;
}

41 changes: 31 additions & 10 deletions CSG/tests/DemoGrid.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#include <algorithm>
#include <string>
#include <sstream>
#include <iostream>

#include "SStr.hh"
#include "ssys.h"
#include "sstr.h"
#include "scuda.h"
#include "saabb.h"

Expand All @@ -11,6 +13,26 @@
#include "SLOG.hh"
#include "CSGFoundry.h"

namespace
{
void ParseGridSpec(std::array<int,9>& grid, const char* spec)
{
std::vector<int> values;
std::stringstream ss(spec ? spec : "");
std::string item;
while(std::getline(ss, item, ',')) sstr::split<int>(values, item.c_str(), ':');
assert(values.size() == grid.size());
std::copy(values.begin(), values.end(), grid.begin());
}

void GridMinMax(const std::array<int,9>& grid, glm::ivec3& mn, glm::ivec3& mx)
{
mn.x = grid[0] ; mx.x = grid[1] ;
mn.y = grid[3] ; mx.y = grid[4] ;
mn.z = grid[6] ; mx.z = grid[7] ;
}
}


float4 DemoGrid::AddInstances( CSGFoundry* foundry_, unsigned ias_idx_, unsigned num_solid_ ) // static
{
Expand All @@ -23,17 +45,17 @@
foundry(foundry_),
ias_idx(ias_idx_),
num_solid(num_solid_),
gridscale(SStr::GetEValue<float>("GRIDSCALE", 1.f))
gridscale(ssys::getenvfloat("GRIDSCALE", 1.f))
{
std::string gridspec = SStr::GetEValue<std::string>("GRIDSPEC","-10:11,2,-10:11:2,-10:11,2") ;
SStr::ParseGridSpec(grid, gridspec.c_str()); // string parsed into array of 9 ints
SStr::GetEVector(solid_modulo, "GRIDMODULO", "0,1" );
SStr::GetEVector(solid_single, "GRIDSINGLE", "2" );
std::string gridspec = ssys::getenv_<std::string>("GRIDSPEC", "-10:11,2,-10:11:2,-10:11,2") ;
ParseGridSpec(grid, gridspec.c_str());
ssys::fill_evec<unsigned>(solid_modulo, "GRIDMODULO", "0,1", ',');
ssys::fill_evec<unsigned>(solid_single, "GRIDSINGLE", "2", ',');

LOG(info) << "GRIDSPEC " << gridspec ;
LOG(info) << "GRIDSCALE " << gridscale ;
LOG(info) << "GRIDMODULO " << SStr::Present(solid_modulo) ;
LOG(info) << "GRIDSINGLE " << SStr::Present(solid_single) ;
LOG(info) << "GRIDMODULO " << ssys::desc_vec(&solid_modulo) ;
LOG(info) << "GRIDSINGLE " << ssys::desc_vec(&solid_single) ;

init(); // add qat4 instances to foundry
}
Expand All @@ -43,7 +65,7 @@
{
glm::ivec3 imn(0,0,0);
glm::ivec3 imx(0,0,0);
SStr::GridMinMax(grid, imn, imx);
GridMinMax(grid, imn, imx);

float3 mn = gridscale*make_float3( float(imn.x), float(imn.y), float(imn.z) ) ;
float3 mx = gridscale*make_float3( float(imx.x), float(imx.y), float(imx.z) ) ;
Expand Down Expand Up @@ -105,4 +127,3 @@
}
}
}

12 changes: 6 additions & 6 deletions CSGOptiX/CSGOptiX.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/**
CSGOptiX.cc
============
Expand Down Expand Up @@ -30,7 +30,7 @@
#include "SEventConfig.hh"
#include "SGeoConfig.hh"
#include "SSim.hh"
#include "SStr.hh"
#include "sstr.h"
#include "SEvt.hh"
#include "SMeta.hh"
#include "SPath.hh"
Expand Down Expand Up @@ -1370,7 +1370,7 @@
LOG(LEVEL) << " path " << path ;

const char* top_extra = pip->desc();
const char* topline = SStr::Concat(top_line, top_extra);
const std::string topline = sstr::Concat_(top_line, top_extra);

LOG(LEVEL) << " path_ [" << path_ << "]" ;
LOG(LEVEL) << " topline " << topline ;
Expand All @@ -1387,14 +1387,14 @@
LOG(LEVEL) << "] frame.download " ;

LOG(LEVEL) << "[ frame.annotate " ;
framebuf->annotate( bottom_line, topline, line_height );
framebuf->annotate( bottom_line, topline.c_str(), line_height );
LOG(LEVEL) << "] frame.annotate " ;

LOG(LEVEL) << "[ frame.snap " ;
framebuf->snap( path );
LOG(LEVEL) << "] frame.snap " ;

if(!flight || SStr::Contains(path,"00000"))
if(!flight || sstr::Contains(path,"00000"))
{
saveMeta(path);
}
Expand All @@ -1416,7 +1416,7 @@

void CSGOptiX::saveMeta(const char* jpg_path) const
{
const char* json_path = SStr::ReplaceEnd(jpg_path, ".jpg", ".json");
const std::string json_path = sstr::ReplaceEnd_(jpg_path, ".jpg", ".json");
LOG(LEVEL) << "[ json_path " << json_path ;

nlohmann::json& js = meta->js ;
Expand All @@ -1442,7 +1442,7 @@
js["av"] = av ;
}

meta->save(json_path);
meta->save(json_path.c_str());
LOG(LEVEL) << "] json_path " << json_path ;
}

Expand Down
4 changes: 2 additions & 2 deletions CSGOptiX/Frame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "SFrameConfig.hh"
#include "SComp.h"
#include "SStr.hh"
#include "ssys.h"
#include "SPath.hh"
#include "SLOG.hh"
#include "NP.hh"
Expand Down Expand Up @@ -58,7 +58,7 @@ Frame::Frame(int width_, int height_, int depth_, uchar4* d_pixel_, float4* d_is
height(height_),
depth(depth_),
channels(4),
jpg_quality(SStr::GetEValue<int>("QUALITY", 50)),
jpg_quality(ssys::getenv_<int>("QUALITY", 50)),
img(new SIMG(width, height, channels, nullptr )),
num_pixels(width*height),
d_pixel(d_pixel_ == nullptr ? DeviceAlloc<uchar4>(num_pixels, mask & SCOMP_PIXEL ) : d_pixel_ ),
Expand Down
2 changes: 0 additions & 2 deletions qudarap/tests/QCKTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ by both lookup sampling and for comparison by the traditional rejection sampling
#include <iomanip>
#include <random>

#include "SStr.hh"
#include "SRng.hh"
#include "SPath.hh"
#include "QCK.hh"
Expand Down Expand Up @@ -198,4 +197,3 @@ int main(int argc, char** argv)

return 0 ;
}

3 changes: 0 additions & 3 deletions sysrap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ set(SOURCES
SProf.cc
SMeta.cc


SStr.cc
SPath.cc
SSeq.cc
STranche.cc
Expand Down Expand Up @@ -147,7 +145,6 @@ set(HEADERS
SSys.hh

sstr.h
SStr.hh

schrono.h
stimer.h
Expand Down
Loading
Loading