Ejemplo n.º 1
0
//==============================================================================
int performCommandLine (const String& commandLine)
{
    StringArray args;
    args.addTokens (commandLine, true);
    args.trim();

    String command (args[0]);

    try
    {
        if (matchArgument (command, "help"))                     { showHelp(); return 0; }
        if (matchArgument (command, "h"))                        { showHelp(); return 0; }
        if (matchArgument (command, "resave"))                   { resaveProject (args, false); return 0; }
        if (matchArgument (command, "resave-resources"))         { resaveProject (args, true); return 0; }
        if (matchArgument (command, "set-version"))              { setVersion (args); return 0; }
        if (matchArgument (command, "bump-version"))             { bumpVersion (args); return 0; }
        if (matchArgument (command, "git-tag-version"))          { gitTag (args); return 0; }
        if (matchArgument (command, "buildmodule"))              { buildModules (args, false); return 0; }
        if (matchArgument (command, "buildallmodules"))          { buildModules (args, true); return 0; }
        if (matchArgument (command, "status"))                   { showStatus (args); return 0; }
        if (matchArgument (command, "trim-whitespace"))          { cleanWhitespace (args, false); return 0; }
        if (matchArgument (command, "remove-tabs"))              { cleanWhitespace (args, true); return 0; }
        if (matchArgument (command, "tidy-divider-comments"))    { tidyDividerComments (args); return 0; }
        if (matchArgument (command, "fix-broken-include-paths")) { fixRelativeIncludePaths (args); return 0; }
    }
    catch (const CommandLineError& error)
    {
        std::cout << error.message << std::endl << std::endl;
        return 1;
    }

    return commandLineNotPerformed;
}
Ejemplo n.º 2
0
void StraightRodPair::buildMezzanine(const RodTemplate& rodTemplate) {
  // compute Z list (only once since the second mezzanine has just inverted signs for z) 
  vector<double> zList = computeZList(rodTemplate.rbegin(), rodTemplate.rend(), startZ(), BuildDir::LEFT, zPlusParity(), false);
  vector<double> zListNeg;
  std::transform(zList.begin(), zList.end(), std::back_inserter(zListNeg), std::negate<double>());

  buildModules(zPlusModules_, rodTemplate, zList, BuildDir::LEFT, zPlusParity(), 1); // CUIDADO mezzanine layer rings in reverse order????
  maxZ(startZ());

  buildModules(zMinusModules_, rodTemplate, zListNeg, BuildDir::RIGHT, zPlusParity(), -1);
}
Ejemplo n.º 3
0
void TiltedRodPair::build(const RodTemplate& rodTemplate, const std::vector<TiltedModuleSpecs>& tmspecs, bool flip) {
  materialObject_.store(propertyTree());
  materialObject_.build();

  try {
    logINFO(Form("Building %s", fullid(*this).c_str()));
    check();
    buildModules(zPlusModules_, rodTemplate, tmspecs, BuildDir::RIGHT, flip);
    buildModules(zMinusModules_, rodTemplate, tmspecs, BuildDir::LEFT, flip);

  } catch (PathfulException& pe) { pe.pushPath(fullid(*this)); throw; }
  cleanup();
  builtok(true);
}
Ejemplo n.º 4
0
//==============================================================================
int performCommandLine (const String& commandLine)
{
    StringArray args;
    args.addTokens (commandLine, true);
    args.trim();

    if (matchArgument (args[0], "help"))                return showHelp();
    if (matchArgument (args[0], "resave"))              return resaveProject (args, false);
    if (matchArgument (args[0], "resave-resources"))    return resaveProject (args, true);
    if (matchArgument (args[0], "buildmodule"))         return buildModules (args, false);
    if (matchArgument (args[0], "buildallmodules"))     return buildModules (args, true);
    if (matchArgument (args[0], "status"))              return showStatus (args);

    return commandLineNotPerformed;
}
Ejemplo n.º 5
0
void Ring::buildTopDown() {
  double startRadius = buildStartRadius()-ringGap();
  if (ringInnerRadius()>0){
    logWARNING("inner radius was set for a top-down endcap building. Ignoring ringInnerRadius.");
  }
  if (ringOuterRadius()>0)  {
    if (ringGap()!=0) logWARNING("outerRadius and ringGap were both specified. Ignoring ringGap.");
    startRadius = ringOuterRadius();
  }
  buildStartRadius(startRadius);

  RectangularModule* rmod = GeometryFactory::make<RectangularModule>();
  rmod->store(propertyTree());

  auto optimalRingParms = computeOptimalRingParametersRectangle(rmod->width(), buildStartRadius());
  int numMods = optimalRingParms.second;

  EndcapModule* emod = GeometryFactory::make<EndcapModule>(rmod);
  emod->store(propertyTree());
  emod->build();
  emod->translate(XYZVector(buildStartRadius() - rmod->length()/2, 0, 0));

  minRadius_ = buildStartRadius() - rmod->length();
  maxRadius_ = buildStartRadius();

  if (numModules.state()) numMods = numModules();
  else numModules(numMods);
  buildModules(emod, numMods, smallDelta());

  delete emod;
}
Ejemplo n.º 6
0
void StraightRodPair::buildFull(const RodTemplate& rodTemplate) {
  double startZ = startZMode() == StartZMode::MODULECENTER ? -(*rodTemplate.begin())->length()/2. : 0.;
  auto zListPair = computeZListPair(rodTemplate.begin(), rodTemplate.end(), startZ, 0);

    // actual module creation
    // CUIDADO log rod balancing effort
  buildModules(zPlusModules_, rodTemplate, zListPair.first, BuildDir::RIGHT, zPlusParity(), 1);
  double currMaxZ = zPlusModules_.size() > 1 ? MAX(zPlusModules_.rbegin()->planarMaxZ(), (zPlusModules_.rbegin()+1)->planarMaxZ()) : (!zPlusModules_.empty() ? zPlusModules_.rbegin()->planarMaxZ() : 0.); 
  // CUIDADO this only checks the positive side... the negative side might actually have a higher fabs(maxZ) if the barrel is long enough and there's an inversion
  buildModules(zMinusModules_, rodTemplate, zListPair.second, BuildDir::LEFT, -zPlusParity(), -1);

  auto collisionsZPlus = solveCollisionsZPlus();
  auto collisionsZMinus = solveCollisionsZMinus();
  if (!collisionsZPlus.empty() || !collisionsZMinus.empty()) logWARNING("Some modules have been translated to avoid collisions. Check info tab");

  if (compressed() && maxZ.state() && currMaxZ > maxZ()) compressToZ(maxZ());
  currMaxZ = zPlusModules_.size() > 1 ? MAX(zPlusModules_.rbegin()->planarMaxZ(), (zPlusModules_.rbegin()+1)->planarMaxZ()) : (!zPlusModules_.empty() ? zPlusModules_.rbegin()->planarMaxZ() : 0.); 
  maxZ(currMaxZ);
}
Ejemplo n.º 7
0
//==============================================================================
int performCommandLine (const String& commandLine)
{
    StringArray args;
    args.addTokens (commandLine, true);
    args.trim();

    if (findArgument (args, "--lf") || findArgument (args, "-lf"))
       preferredLinefeed = "\n";

    String command (args[0]);

    try
    {
        if (matchArgument (command, "help"))                     { showHelp();                            return 0; }
        if (matchArgument (command, "h"))                        { showHelp();                            return 0; }
        if (matchArgument (command, "resave"))                   { resaveProject (args, false);           return 0; }
        if (matchArgument (command, "resave-resources"))         { resaveProject (args, true);            return 0; }
        if (matchArgument (command, "get-version"))              { getVersion (args);                     return 0; }
        if (matchArgument (command, "set-version"))              { setVersion (args);                     return 0; }
        if (matchArgument (command, "bump-version"))             { bumpVersion (args);                    return 0; }
        if (matchArgument (command, "git-tag-version"))          { gitTag (args);                         return 0; }
        if (matchArgument (command, "buildmodule"))              { buildModules (args, false);            return 0; }
        if (matchArgument (command, "buildallmodules"))          { buildModules (args, true);             return 0; }
        if (matchArgument (command, "status"))                   { showStatus (args);                     return 0; }
        if (matchArgument (command, "trim-whitespace"))          { cleanWhitespace (args, false);         return 0; }
        if (matchArgument (command, "remove-tabs"))              { cleanWhitespace (args, true);          return 0; }
        if (matchArgument (command, "tidy-divider-comments"))    { tidyDividerComments (args);            return 0; }
        if (matchArgument (command, "fix-broken-include-paths")) { fixRelativeIncludePaths (args);        return 0; }
        if (matchArgument (command, "obfuscated-string-code"))   { generateObfuscatedStringCode (args);   return 0; }
        if (matchArgument (command, "encode-binary"))            { encodeBinary (args);                   return 0; }
        if (matchArgument (command, "trans"))                    { scanFoldersForTranslationFiles (args); return 0; }
        if (matchArgument (command, "trans-finish"))             { createFinishedTranslationFile (args);  return 0; }
        if (matchArgument (command, "set-global-search-path"))   { setGlobalPath (args);                  return 0; }
        if (matchArgument (command, "create-project-from-pip"))  { createProjectFromPIP (args);           return 0; }
    }
    catch (const CommandLineError& error)
    {
        std::cout << error.message << std::endl << std::endl;
        return 1;
    }

    return commandLineNotPerformed;
}
Ejemplo n.º 8
0
//==============================================================================
int performCommandLine (const String& commandLine)
{
    StringArray args;
    args.addTokens (commandLine, true);
    args.trim();

    String command (args[0]);

    if (matchArgument (command, "help"))                return showHelp();
    if (matchArgument (command, "h"))                   return showHelp();
    if (matchArgument (command, "resave"))              return resaveProject (args, false);
    if (matchArgument (command, "resave-resources"))    return resaveProject (args, true);
    if (matchArgument (command, "set-version"))         return setVersion (args);
    if (matchArgument (command, "bump-version"))        return bumpVersion (args);
    if (matchArgument (command, "git-tag-version"))     return gitTag (args);
    if (matchArgument (command, "buildmodule"))         return buildModules (args, false);
    if (matchArgument (command, "buildallmodules"))     return buildModules (args, true);
    if (matchArgument (command, "status"))              return showStatus (args);

    return commandLineNotPerformed;
}
Ejemplo n.º 9
0
bool Engine::start() {
    bool retval {false};

    m_media = std::make_unique<Media>();

    if (m_media->init()) {
        buildKernel();
        if (buildModules()) {
            m_kernel->start();
            retval = true;
        }
    }

    return retval;
}
Ejemplo n.º 10
0
void Ring::buildBottomUp() {
  double startRadius = buildStartRadius()+ringGap();
  if (ringOuterRadius()>0){
    logWARNING("outer radius was set for a bottom-up endcap building. Ignoring ringOuterRadius.");
  }
  if (ringInnerRadius()>0)  {
    if (ringGap()!=0) logWARNING("innerRadius and ringGap were both specified. Ignoring ringGap.");
    startRadius = ringInnerRadius();
  }
  buildStartRadius(startRadius);

  int numMods;
  double modLength;

  EndcapModule* emod = nullptr;
  if (moduleShape() == ModuleShape::WEDGE) {
    WedgeModule* wmod = GeometryFactory::make<WedgeModule>();
    wmod->store(propertyTree());

    auto optimalRingParms = computeOptimalRingParametersWedge(wmod->waferDiameter(), buildStartRadius());
    double alpha = optimalRingParms.first;
    numMods = optimalRingParms.second;

    wmod->buildAperture(alpha);
    wmod->buildDistance(buildStartRadius());
    wmod->buildCropDistance(buildCropRadius());

    wmod->build();

    modLength = wmod->length();

    emod = GeometryFactory::make<EndcapModule>(wmod);

  } else {

    RectangularModule* rmod = GeometryFactory::make<RectangularModule>();
    rmod->store(propertyTree());
    rmod->build();

    auto optimalRingParms = computeOptimalRingParametersRectangle(rmod->width(), buildStartRadius() + rmod->length());
    numMods = optimalRingParms.second;

    modLength = rmod->length();

    emod = GeometryFactory::make<EndcapModule>(rmod); 

  }

  emod->store(propertyTree());
  emod->build();
  emod->translate(XYZVector(buildStartRadius() + modLength/2, 0, 0));

  minRadius_ = buildStartRadius();
  maxRadius_ = buildStartRadius() + modLength;

  if (numModules.state()) numMods = numModules();
  else numModules(numMods);
  buildModules(emod, numMods, smallDelta());

  delete emod;
}