Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QScopedPointer<QApplication> app(createApplication(argc, argv));

    qDebug() << "root path: " << Sbs2Common::setDefaultRootAppPath();
    qDebug() << "catalog path: " << Sbs2Common::setDefaultCatalogPath();

    MyCallback* myCallback = new MyCallback();
    Sbs2EmotivDataReader* sbs2DataReader = Sbs2EmotivDataReader::New(myCallback);

    Tests* tests = new Tests();
    tests->run();

    QmlApplicationViewer viewer;
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
    viewer.setMainQmlFile(QLatin1String("qml/sbs2-Test/main.qml"));
    viewer.showExpanded();

    return app->exec();
}
Пример #2
0
/**
 * @brief Runs structure0815
 */
int main(int argc, char **argv)
{
  STRUCTURE_INFO("Starting Structure0815");

  if (argc != 2){
    STRUCTURE_INFO("Usage: ./structure0815 configurationFileName/tests");
    abort();
  }
  std::string configFileName(argv[1]);

  if (configFileName == std::string("tests")){
    Tests tests;
    tests.run();
    return 1;
  }

  std::string meshName("WetSurface");

  SolverInterface cplInterface("Structure0815", 0, 1);
  cplInterface.configure(configFileName);
  double dt = cplInterface.initialize();

  std::string writeCheckpoint(constants::actionWriteIterationCheckpoint());
  std::string readCheckpoint(constants::actionReadIterationCheckpoint());

  int dimensions = cplInterface.getDimensions();
  double density = 500.0;
  DynVector gravity (dimensions, 0.0); //-9.81;
  gravity(1) = -9.81;

  STRUCTURE_INFO("Density = " << density);
  STRUCTURE_INFO("Gravity = " << gravity);

  if ( not cplInterface.hasMesh(meshName) ){
    STRUCTURE_INFO("Mesh \"" << meshName << "\" required for coupling!");
    exit(-1);
  }
  MeshHandle handle = cplInterface.getMeshHandle(meshName);

  int velocitiesID = -1;
  int forcesID = -1;
  int displacementsID = -1;
  int displDeltasID = -1;
  int velocityDeltasID = -1;

  if (not cplInterface.hasData(constants::dataForces())){
    STRUCTURE_INFO("Data \"Forces\" required for coupling!");
    exit(-1);
  }
  forcesID = cplInterface.getDataID(constants::dataForces());
  if (cplInterface.hasData(constants::dataVelocities())){
    velocitiesID = cplInterface.getDataID(constants::dataVelocities());
  }
  if (cplInterface.hasData(constants::dataDisplacements())){
    displacementsID = cplInterface.getDataID(constants::dataDisplacements());
  }
  if (cplInterface.hasData("DisplacementDeltas")){
    displDeltasID = cplInterface.getDataID("DisplacementDeltas");
  }
  if (cplInterface.hasData("VelocityDeltas")){
    velocityDeltasID = cplInterface.getDataID("VelocityDeltas");
  }

  DynVector nodes(handle.vertices().size()*dimensions);
  tarch::la::DynamicVector<int> faces;
  size_t iVertex = 0;
  VertexHandle vertices = handle.vertices();
  foriter (VertexIterator, it, vertices){
    for (int i=0; i < dimensions; i++){
      nodes[iVertex*dimensions+i] = it.vertexCoords()[i];
    }
    iVertex++;
  }
  if (dimensions == 2){
    faces.append(handle.edges().size()*2, 0);
    EdgeHandle edges = handle.edges();
    int iEdge = 0;
    foriter (EdgeIterator, it, edges){
      for (int i=0; i < 2; i++){
        faces[iEdge*2+i] = it.vertexID(i);
      }
      iEdge++;
    }
  }