const NOX::Abstract::Vector&
LOCA::Extended::MultiVector::operator [] (int i) const
{
  return *(getVector(i));
}
Exemplo n.º 2
0
//-------------------------------------------------------------------------------------
PyObject* ScriptVector3::pyGetZ()
{ 
	return PyFloat_FromDouble(getVector().z); 
}
Exemplo n.º 3
0
inline void callFunction(mxArray* plhs[], const mxArray*prhs[],
      const int nlhs) {
   if (!mexCheckType<T>(prhs[2]))
      mexErrMsgTxt("type of argument 3 is not consistent");
   if (mxIsSparse(prhs[2]))
      mexErrMsgTxt("argument 3 should not be sparse");

   if (!mxIsStruct(prhs[3])) 
      mexErrMsgTxt("argument 4 should be a struct");

   Vector<T> y;
   getVector(prhs[0],y);
   INTM n = y.n();

   const mwSize* dimsX=mxGetDimensions(prhs[1]);
   INTM p=static_cast<INTM>(dimsX[0]);
   INTM nX=static_cast<INTM>(dimsX[1]);
   if (nX != n) mexErrMsgTxt("second argument should be p x n");

   Matrix<T> w0;
   getMatrix(prhs[2],w0);
   int pw = w0.m();
   if (pw != p) mexErrMsgTxt("third argument should be p x nlambda");

   mxArray *pr_lambdas = mxGetField(prhs[3],0,"lambda");
   if (!pr_lambdas) 
      mexErrMsgTxt("Missing field lambda");
   Vector<T> lambdas;
   getVector(pr_lambdas,lambdas);
   int nlambdas=lambdas.n();
   if (nlambdas != w0.n()) mexErrMsgTxt("third argument should be p x nlambda");

   plhs[0]=createMatrix<T>(p,nlambdas);
   Matrix<T> w;
   getMatrix(plhs[0],w);

   ParamSurrogate<T> param;
   param.num_threads = getScalarStructDef<int>(prhs[3],"numThreads",-1);
   const int seed=getScalarStructDef<int>(prhs[3],"seed",0);
   param.strategy=getScalarStructDef<int>(prhs[3],"strategy",3);
   srandom(seed);
   param.epochs = getScalarStruct<long>(prhs[3],"epochs");
   const bool seq = getScalarStructDef<bool>(prhs[3],"warm_restart",false);
   param.minibatches = getScalarStructDef<int>(prhs[3],"minibatches",1);
   param.normalized = getScalarStructDef<bool>(prhs[3],"normalized",false);
   param.verbose = getScalarStructDef<bool>(prhs[3],"verbose",false);

   ParamFISTA<T> paramprox;
   getStringStruct(prhs[3],"regul",paramprox.name_regul,paramprox.length_names);
   paramprox.regul = regul_from_string(paramprox.name_regul);
   paramprox.a=getScalarStructDef<T>(prhs[3],"eps",0);
   if (paramprox.regul==INCORRECT_REG)
      mexErrMsgTxt("Unknown regularization");
   getStringStruct(prhs[3],"loss",paramprox.name_loss,paramprox.length_names);
   paramprox.loss = loss_from_string(paramprox.name_loss);
   if (paramprox.loss==INCORRECT_LOSS)
      mexErrMsgTxt("Unknown loss");

   if (param.num_threads == -1) {
#ifdef _OPENMP
      init_omp(MIN(MAX_THREADS,omp_get_num_procs()));
#endif
   } else {
#ifdef _OPENMP
      init_omp(param.num_threads);
#endif
   }

   Matrix<T> optim;
   if (nlhs==2) {
      plhs[1]=createMatrix<T>(3,nlambdas);
      getMatrix<T>(plhs[1],optim);
   } else {
      optim.resize(3,nlambdas);
   }
   if (mxIsSparse(prhs[1])) {
      double* X_v;
      mwSize* X_r, *X_pB, *X_pE;
      INTM* X_r2, *X_pB2, *X_pE2;
      T* X_v2;
      X_v=static_cast<double*>(mxGetPr(prhs[1]));
      X_r=mxGetIr(prhs[1]);
      X_pB=mxGetJc(prhs[1]);
      X_pE=X_pB+1;
      createCopySparse<T>(X_v2,X_r2,X_pB2,X_pE2,
            X_v,X_r,X_pB,X_pE,n);
      SpMatrix<T> X(X_v2,X_r2,X_pB2,X_pE2,p,n,X_pB2[n]);
      if (seq) {
         incrementalProximalSeq(y,X,w0,w,paramprox,param,lambdas,optim);
      } else {
         incrementalProximal(y,X,w0,w,paramprox,param,lambdas,optim);
      }
      deleteCopySparse<T>(X_v2,X_r2,X_pB2,X_pE2,X_v,X_r);
   } else {
      T* prX = reinterpret_cast<T*>(mxGetPr(prhs[1]));
      Matrix<T> X(prX,p,n);
      if (seq) {
         incrementalProximalSeq(y,X,w0,w,paramprox,param,lambdas,optim);
      } else {
         incrementalProximal(y,X,w0,w,paramprox,param,lambdas,optim);
      }
   }
}
Exemplo n.º 4
0
//-------------------------------------------------------------------------------------
int ScriptVector4::pySetW(PyObject *value)
{ 
	getVector().w = float(PyFloat_AsDouble(value)); 
	return 0; 
}
Exemplo n.º 5
0
 const PhosimPar & PhosimParser::operator[](const std::string & key) const {
     return getVector(key).back();
 }
Teuchos::RCP<NOX::Abstract::Vector>
LOCA::Hopf::MooreSpence::ExtendedVector::getImagEigenVec()
{
  return getVector(2);
}
Exemplo n.º 7
0
// -------------------------------------------------------------------
//  File parsing method.
void ObjFileParser::parseFile()
{
    if (m_DataIt == m_DataItEnd)
        return;

    while (m_DataIt != m_DataItEnd)
    {
        switch (*m_DataIt)
        {
        case 'v': // Parse a vertex texture coordinate
            {
                ++m_DataIt;
                if (*m_DataIt == ' ' || *m_DataIt == '\t') {
                    // read in vertex definition
                    getVector3(m_pModel->m_Vertices);
                } else if (*m_DataIt == 't') {
                    // read in texture coordinate ( 2D or 3D )
                                        ++m_DataIt;
                                        getVector( m_pModel->m_TextureCoord );
                } else if (*m_DataIt == 'n') {
                    // Read in normal vector definition
                    ++m_DataIt;
                    getVector3( m_pModel->m_Normals );
                }
            }
            break;

        case 'p': // Parse a face, line or point statement
        case 'l':
        case 'f':
            {
                getFace(*m_DataIt == 'f' ? aiPrimitiveType_POLYGON : (*m_DataIt == 'l'
                    ? aiPrimitiveType_LINE : aiPrimitiveType_POINT));
            }
            break;

        case '#': // Parse a comment
            {
                getComment();
            }
            break;

        case 'u': // Parse a material desc. setter
            {
                getMaterialDesc();
            }
            break;

        case 'm': // Parse a material library or merging group ('mg')
            {
                if (*(m_DataIt + 1) == 'g')
                    getGroupNumberAndResolution();
                else
                    getMaterialLib();
            }
            break;

        case 'g': // Parse group name
            {
                getGroupName();
            }
            break;

        case 's': // Parse group number
            {
                getGroupNumber();
            }
            break;

        case 'o': // Parse object name
            {
                getObjectName();
            }
            break;

        default:
            {
                m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
            }
            break;
        }
    }
}
Exemplo n.º 8
0
int main(int argc, char *argv[])
{
  // Create output stream. (Handy for multicore output.)
  auto out = Teuchos::VerboseObjectBase::getDefaultOStream();

  Teuchos::GlobalMPISession session(&argc, &argv, NULL);

  auto comm = Teuchos::DefaultComm<int>::getComm();

  // Wrap the whole code in a big try-catch-statement.
  bool success = true;
  try {
    // =========================================================================
    // Handle command line arguments.
    // Boost::program_options is somewhat more complete here (e.g. you can
    // specify options without the "--" syntax), but it isn't less complicated
    // to use. Stick with Teuchos for now.
    Teuchos::CommandLineProcessor myClp;

    myClp.setDocString(
      "Numerical parameter continuation for nonlinear Schr\"odinger equations.\n"
    );

    std::string xmlInputPath = "";
    myClp.setOption("xml-input-file", &xmlInputPath,
                    "XML file containing the parameter list", true );

    // Print warning for unrecognized arguments and make sure to throw an
    // exception if something went wrong.
    //myClp.throwExceptions(false);
    //myClp.recogniseAllOptions ( true );

    // Finally, parse the command line.
    myClp.parse(argc, argv);

    // Retrieve Piro parameter list from given file.
    std::shared_ptr<Teuchos::ParameterList> piroParams(
        new Teuchos::ParameterList()
        );
    Teuchos::updateParametersFromXmlFile(
        xmlInputPath,
        Teuchos::rcp(piroParams).ptr()
        );
    // =======================================================================
    // Extract the location of input and output files.
    const Teuchos::ParameterList outputList =
      piroParams->sublist("Output", true);

    // Set default directory to be the directory of the XML file itself
    const std::string xmlDirectory =
      xmlInputPath.substr(0, xmlInputPath.find_last_of( "/" ) + 1);

    // By default, take the current directory.
    std::string prefix = "./";
    if (!xmlDirectory.empty())
      prefix = xmlDirectory + "/";

    const std::string outputDirectory = prefix;

    const std::string contFilePath =
      prefix + outputList.get<std::string>("Continuation data file name");

    Teuchos::ParameterList & inputDataList = piroParams->sublist("Input", true);

    const std::string inputExodusFile =
      prefix + inputDataList.get<std::string>("File");
    const int step = inputDataList.get<int>("Initial Psi Step");

    //const bool useBordering = piroParams->get<bool>("Bordering");
    // =======================================================================
    // Read the data from the file.
    auto mesh = std::make_shared<Nosh::StkMesh>(
        Teuchos::get_shared_ptr(comm),
        inputExodusFile,
        step
        );

    // Cast the data into something more accessible.
    auto psi = mesh->getComplexVector("psi");
    //psi->Random();

    // Set the output directory for later plotting with this.
    std::stringstream outputFile;
    outputFile << outputDirectory << "/solution.e";
    mesh->openOutputChannel(outputFile.str());

    // Create a parameter map from the initial parameter values.
    Teuchos::ParameterList initialParameterValues =
      piroParams->sublist("Initial parameter values", true);

    // Check if we need to interpret the time value stored in the file
    // as a parameter.
    const std::string & timeName =
      piroParams->get<std::string>("Interpret time as", "");
    if (!timeName.empty()) {
      initialParameterValues.set(timeName, mesh->getTime());
    }

    // Explicitly set the initial parameter value for this list.
    const std::string & paramName =
      piroParams->sublist( "LOCA" )
      .sublist( "Stepper" )
      .get<std::string>("Continuation Parameter");
    *out << "Setting the initial parameter value of \""
         << paramName << "\" to " << initialParameterValues.get<double>(paramName) << "." << std::endl;
    piroParams->sublist( "LOCA" )
    .sublist( "Stepper" )
    .set("Initial Value", initialParameterValues.get<double>(paramName));

    // Set the thickness field.
    auto thickness = std::make_shared<Nosh::ScalarField::Constant>(*mesh, 1.0);

    // Some alternatives for the positive-definite operator.
    // (a) -\Delta (Laplace operator with Neumann boundary)
    //const std::shared_ptr<Nosh::ParameterMatrix::Virtual> matrixBuilder =
    //  rcp(new Nosh::ParameterMatrix::Laplace(mesh, thickness));

    // (b) (-i\nabla-A)^2 (Kinetic energy of a particle in magnetic field)
    // (b1) 'A' explicitly given in file.
    const double mu = initialParameterValues.get<double>("mu");
    auto mvp = std::make_shared<Nosh::VectorField::ExplicitValues>(*mesh, "A", mu);

    //const std::shared_ptr<Nosh::ParameterMatrix::Virtual> keoBuilder(
    //    new Nosh::ParameterMatrix::Keo(mesh, thickness, mvp)
    //    );
    //const std::shared_ptr<Nosh::ParameterMatrix::Virtual> DKeoDPBuilder(
    //    new Nosh::ParameterMatrix::DKeoDP(mesh, thickness, mvp, "mu")
    //    );

    // (b2) 'A' analytically given (here with constant curl).
    //      Optionally add a rotation axis u. This is important
    //      if continuation happens as a rotation of the vector
    //      field around an axis.
    //const std::shared_ptr<DoubleVector> b = rcp(new DoubleVector(3));
    //std::shared_ptr<Teuchos::SerialDenseVector<int,double> > u = Teuchos::null;
    //if ( piroParams->isSublist("Rotation vector") )
    //{
    //    u = rcp(new Teuchos::SerialDenseVector<int,double>(3));
    //    Teuchos::ParameterList & rotationVectorList =
    //        piroParams->sublist( "Rotation vector", false );
    //    (*u)[0] = rotationVectorList.get<double>("x");
    //    (*u)[1] = rotationVectorList.get<double>("y");
    //    (*u)[2] = rotationVectorList.get<double>("z");
    //}
    //std::shared_ptr<Nosh::VectorField::Virtual> mvp =
    //  rcp(new Nosh::VectorField::ConstantCurl(mesh, b, u));
    //const std::shared_ptr<Nosh::ParameterMatrix::Virtual> matrixBuilder =
    //  rcp(new Nosh::ParameterMatrix::Keo(mesh, thickness, mvp));
    // (b3) 'A' analytically given in a class you write yourself, derived
    //      from Nosh::ParameterMatrix::Virtual.
    // [...]
    //
    // Setup the scalar potential V.
    // (a) A constant potential.
    //std::shared_ptr<Nosh::ScalarField::Virtual> sp =
    //rcp(new Nosh::ScalarField::Constant(*mesh, -1.0));
    //const double T = initialParameterValues.get<double>("T");
    // (b) With explicit values.
    //std::shared_ptr<Nosh::ScalarField::Virtual> sp =
    //rcp(new Nosh::ScalarField::ExplicitValues(*mesh, "V"));
    // (c) One you built yourself by deriving from Nosh::ScalarField::Virtual.
    auto sp = std::make_shared<MyScalarField>(mesh);


    const double g = initialParameterValues.get<double>("g");
    // Finally, create the model evaluator.
    // This is the most important object in the whole stack.
    auto modelEvaluator = std::make_shared<Nosh::ModelEvaluator::Nls>(
        mesh,
        mvp,
        sp,
        g,
        thickness,
        psi,
        "mu"
        );

    // Build the Piro model evaluator. It's used to hook up with
    // several different backends (NOX, LOCA, Rhythmos,...).
    std::shared_ptr<Thyra::ModelEvaluator<double>> piro;

    // Declare the eigensaver; it will be used only for LOCA solvers, though.
    std::shared_ptr<Nosh::SaveEigenData> glEigenSaver;

    // Switch by solver type.
    std::string & solver = piroParams->get<std::string>("Piro Solver");

    if (solver == "NOX") {
      auto observer = std::make_shared<Nosh::Observer>(modelEvaluator);

      piro = std::make_shared<Piro::NOXSolver<double>>(
            Teuchos::rcp(piroParams),
            Teuchos::rcp(modelEvaluator),
            Teuchos::rcp(observer)
            );
    } else if (solver == "LOCA") {
      auto observer = std::make_shared<Nosh::Observer>(
          modelEvaluator,
          contFilePath,
          piroParams->sublist("LOCA")
          .sublist("Stepper")
          .get<std::string>("Continuation Parameter")
          );

      // Setup eigen saver.
#ifdef HAVE_LOCA_ANASAZI
      bool computeEigenvalues = piroParams->sublist( "LOCA" )
                                .sublist( "Stepper" )
                                .get<bool>("Compute Eigenvalues");
      if (computeEigenvalues) {
        Teuchos::ParameterList & eigenList = piroParams->sublist("LOCA")
                                             .sublist("Stepper")
                                             .sublist("Eigensolver");
        std::string eigenvaluesFilePath =
          xmlDirectory + "/" + outputList.get<std::string> ( "Eigenvalues file name" );

        glEigenSaver = std::make_shared<Nosh::SaveEigenData>(
            eigenList,
            modelEvaluator,
            eigenvaluesFilePath
            );

        std::shared_ptr<LOCA::SaveEigenData::AbstractStrategy>
          glSaveEigenDataStrategy = glEigenSaver;
        eigenList.set("Save Eigen Data Method",
                      "User-Defined");
        eigenList.set("User-Defined Save Eigen Data Name",
                      "glSaveEigenDataStrategy");
        eigenList.set("glSaveEigenDataStrategy",
                      glSaveEigenDataStrategy);
      }
#endif
      // Get the solver.
      std::shared_ptr<Piro::LOCASolver<double>> piroLOCASolver(
          new Piro::LOCASolver<double>(
            Teuchos::rcp(piroParams),
            Teuchos::rcp(modelEvaluator),
            Teuchos::null
            //Teuchos::rcp(observer)
            )
          );

//      // Get stepper and inject it into the eigensaver.
//      std::shared_ptr<LOCA::Stepper> stepper = Teuchos::get_shared_ptr(
//          piroLOCASolver->getLOCAStepperNonConst()
//          );
//#ifdef HAVE_LOCA_ANASAZI
//      if (computeEigenvalues)
//        glEigenSaver->setLocaStepper(stepper);
//#endif
      piro = piroLOCASolver;
    }
#if 0
    else if ( solver == "Turning Point" ) {
      std::shared_ptr<Nosh::Observer> observer;

      Teuchos::ParameterList & bifList =
        piroParams->sublist("LOCA").sublist("Bifurcation");

      // Fetch the (approximate) null state.
      auto nullstateZ = mesh->getVector("null");

      // Set the length normalization vector to be the initial null vector.
      TEUCHOS_ASSERT(nullstateZ);
      auto lengthNormVec = Teuchos::rcp(new NOX::Thyra::Vector(*nullstateZ));
      //lengthNormVec->init(1.0);
      bifList.set("Length Normalization Vector", lengthNormVec);

      // Set the initial null vector.
      auto initialNullAbstractVec =
        Teuchos::rcp(new NOX::Thyra::Vector(*nullstateZ));
      // initialNullAbstractVec->init(1.0);
      bifList.set("Initial Null Vector", initialNullAbstractVec);

      piro = std::make_shared<Piro::LOCASolver<double>>(
            Teuchos::rcp(piroParams),
            Teuchos::rcp(modelEvaluator),
            Teuchos::null
            //Teuchos::rcp(observer)
            );
    }
#endif
    else {
      TEUCHOS_TEST_FOR_EXCEPT_MSG(
          true,
          "Unknown solver type \"" << solver << "\"."
          );
    }
    // ----------------------------------------------------------------------

    // Now the setting of inputs and outputs.
    Thyra::ModelEvaluatorBase::InArgs<double> inArgs = piro->createInArgs();
    inArgs.set_p(
        0,
        piro->getNominalValues().get_p(0)
        );

    // Set output arguments to evalModel call.
    Thyra::ModelEvaluatorBase::OutArgs<double> outArgs = piro->createOutArgs();

    // Now solve the problem and return the responses.
    const Teuchos::RCP<Teuchos::Time> piroSolveTime =
      Teuchos::TimeMonitor::getNewTimer("Piro total solve time");;
    {
      Teuchos::TimeMonitor tm(*piroSolveTime);
      piro->evalModel(inArgs, outArgs);
    }

    // Manually release LOCA stepper.
#ifdef HAVE_LOCA_ANASAZI
    if (glEigenSaver)
      glEigenSaver->releaseLocaStepper();
#endif

    // Print timing data.
    Teuchos::TimeMonitor::summarize();
  } catch (Teuchos::CommandLineProcessor::HelpPrinted) {
  } catch (Teuchos::CommandLineProcessor::ParseError) {
  }
  TEUCHOS_STANDARD_CATCH_STATEMENTS(true, *out, success);

  return success ? EXIT_SUCCESS : EXIT_FAILURE;
}
Exemplo n.º 9
0
//-------------------------------------------------------------------------------------
PyObject* ScriptVector2::pyGetY()
{ 
	return PyFloat_FromDouble(getVector().y); 
}
Exemplo n.º 10
0
/**
  * Decides what to do with the object type if an object is found
  */
void addObject(char **str,
               struct system *System,
               struct tip *Tip,
               struct space *Space,
               struct graphene *Graphene,
               struct substrate *Substrate)
{
	ObjectType type;
	static float zCur = 0; // Current z coordinate to set thickness

	type = getType (*str);

	switch (type)
	{
	case SYSTEM :
		*str = strtok(NULL, " \r\n"); // Go to first coordinate
		System->size = getVector(str);
		break;

	case TIP :
		*str = strtok (NULL, " \r\n"); // Go to first coordinate

		// Check if z value is given for the start of tip, otherwise set it to zero
		if (strchr(*str, ',') != NULL)
		{
			Tip->zStart = getSingleCoord(str);
			*str = strtok(NULL, " \r\n"); // Go to next coordinate
		}
		else
		{
			Tip->zStart = 0;
		}

		Tip->zEnd = getSingleCoord(str);
		zCur = Tip->zEnd;
		break;

	case SPACE :
		Space->zStart = zCur + System->scale;

		*str = strtok (NULL, " \r\n"); // Go to first coordinate
		zCur += getSingleCoord(str); // Set new current z coordinate
		Space->zEnd = zCur - System->scale;
		break;

	case GRAPHENE :
		Graphene->zStart = zCur;

		*str = strtok (NULL, " \r\n"); // Go to first coordinate
		zCur += getSingleCoord(str);
		Graphene->zEnd = zCur;
		break;

	case SUBSTRATE :
		Substrate->zStart = zCur;

		*str = strtok (NULL, " \r\n"); // Go to first coordinate

		// Check if the thickness of the layer is given
		if (*str == NULL)
		{
			// Fill the rest of the system with substrate
			Substrate->zEnd = System->size.z;
		}
		else
		{
			zCur += getSingleCoord(str);
			Substrate->zEnd = zCur;
		}
		break;

	default :
		fprintf (stderr, "Unknown Object Type %s - leaving it out \n", *str);
		*str = strpbrk(*str, "\r\n");
		break;
	}

	if (zCur > System->size.z)
	{
		fprintf(stderr, "System too small! Aborting... \n");
		exit(EXIT_FAILURE);
	}
}
Exemplo n.º 11
0
//-------------------------------------------------------------------------------------
int ScriptVector2::pySetY(PyObject *value)
{ 
	getVector().y = float(PyFloat_AsDouble(value)); 
	return 0; 
}
Exemplo n.º 12
0
//-------------------------------------------------------------------------------------
int ScriptVector3::pySetZ(PyObject *value)
{
	getVector().z = float(PyFloat_AsDouble(value)); 
	return 0; 
}
Exemplo n.º 13
0
float * ConfigMap::getVector(const char * key_) {
  return getVector(const_cast<char*>(key_));
};
Exemplo n.º 14
0
Teuchos::RCP<const LOCA::TurningPoint::MooreSpence::ExtendedVector>
LOCA::TurningPoint::MooreSpence::ExtendedMultiVector::getColumn(int i) const
{
  return Teuchos::rcp_dynamic_cast<const LOCA::TurningPoint::MooreSpence::ExtendedVector>(getVector(i),true);
}
Exemplo n.º 15
0
static void plan_run_PositionVario(vario_type type)
{
    float controlVector[4];
    float alpha;
    PathDesiredData pathDesired;

    PathDesiredGet(&pathDesired);
    FlightModeSettingsPositionHoldOffsetData offset;
    FlightModeSettingsPositionHoldOffsetGet(&offset);


    ManualControlCommandRollGet(&controlVector[0]);
    ManualControlCommandPitchGet(&controlVector[1]);
    ManualControlCommandYawGet(&controlVector[2]);
    ManualControlCommandThrustGet(&controlVector[3]);


    FlightModeSettingsVarioControlLowPassAlphaGet(&alpha);
    vario_control_lowpass[0] = alpha * vario_control_lowpass[0] + (1.0f - alpha) * controlVector[0];
    vario_control_lowpass[1] = alpha * vario_control_lowpass[1] + (1.0f - alpha) * controlVector[1];
    vario_control_lowpass[2] = alpha * vario_control_lowpass[2] + (1.0f - alpha) * controlVector[2];
    controlVector[0] = vario_control_lowpass[0];
    controlVector[1] = vario_control_lowpass[1];
    controlVector[2] = vario_control_lowpass[2];

    // check if movement is desired
    if (normalizeDeadband(controlVector) == false) {
        // no movement desired, re-enter positionHold at current start-position
        if (!vario_hold) {
            vario_hold = true;

            // new hold position is the position that was previously the start position
            pathDesired.End.North   = hold_position[0];
            pathDesired.End.East    = hold_position[1];
            pathDesired.End.Down    = hold_position[2];
            // while the new start position has the same offset as in position hold
            pathDesired.Start.North = pathDesired.End.North + offset.Horizontal; // in FlyEndPoint the direction of this vector does not matter
            pathDesired.Start.East  = pathDesired.End.East;
            pathDesired.Start.Down  = pathDesired.End.Down;

            // set mode explicitly

            PathDesiredSet(&pathDesired);
        }
    } else {
        PositionStateData positionState;
        PositionStateGet(&positionState);

        // flip pitch to have pitch down (away) point north
        controlVector[1] = -controlVector[1];
        getVector(controlVector, type);

        // layout of control Vector : unitVector in movement direction {0,1,2} vector length {3} velocity {4}
        if (vario_hold) {
            // start position is the position that was previously the hold position
            vario_hold = false;
            hold_position[0] = pathDesired.End.North;
            hold_position[1] = pathDesired.End.East;
            hold_position[2] = pathDesired.End.Down;
        } else {
            // start position is advanced according to movement - in the direction of ControlVector only
            // projection using scalar product
            float kp = (positionState.North - hold_position[0]) * controlVector[0]
                       + (positionState.East - hold_position[1]) * controlVector[1]
                       + (positionState.Down - hold_position[2]) * -controlVector[2];
            if (kp > 0.0f) {
                hold_position[0] += kp * controlVector[0];
                hold_position[1] += kp * controlVector[1];
                hold_position[2] += kp * -controlVector[2];
            }
        }
        // new destination position is advanced based on controlVector
        pathDesired.End.North   = hold_position[0] + controlVector[0] * controlVector[3];
        pathDesired.End.East    = hold_position[1] + controlVector[1] * controlVector[3];
        pathDesired.End.Down    = hold_position[2] - controlVector[2] * controlVector[3];
        // the new start position has the same offset as in position hold
        pathDesired.Start.North = pathDesired.End.North + offset.Horizontal; // in FlyEndPoint the direction of this vector does not matter
        pathDesired.Start.East  = pathDesired.End.East;
        pathDesired.Start.Down  = pathDesired.End.Down;
        PathDesiredSet(&pathDesired);
    }
}
Exemplo n.º 16
0
Common::UString GFFStruct::getString(const Common::UString &field,
                                        const Common::UString &def) const {
	load();

	const Field *f = getField(field);
	if (!f)
		return def;

	if (f->type == kFieldTypeExoString) {
		Common::SeekableReadStream &data = getData(*f);

		uint32 length = data.readUint32LE();

		Common::UString str;
		str.readFixedASCII(data, length);
		return str;
	}

	if (f->type == kFieldTypeResRef) {
		Common::SeekableReadStream &data = getData(*f);

		uint32 length = data.readByte();

		Common::UString str;
		str.readFixedASCII(data, length);
		return str;
	}

	if ((f->type == kFieldTypeByte  ) ||
	    (f->type == kFieldTypeUint16) ||
	    (f->type == kFieldTypeUint32) ||
	    (f->type == kFieldTypeUint64)) {

		return Common::UString::sprintf("%lu", getUint(field));
	}

	if ((f->type == kFieldTypeChar  ) ||
	    (f->type == kFieldTypeSint16) ||
	    (f->type == kFieldTypeSint32) ||
	    (f->type == kFieldTypeSint64)) {

		return Common::UString::sprintf("%ld", getSint(field));
	}

	if ((f->type == kFieldTypeFloat) ||
	    (f->type == kFieldTypeDouble)) {

		return Common::UString::sprintf("%lf", getDouble(field));
	}

	if (f->type == kFieldTypeVector) {
		float x, y, z;

		getVector(field, x, y, z);
		return Common::UString::sprintf("%f/%f/%f", x, y, z);
	}

	if (f->type == kFieldTypeOrientation) {
		float a, b, c, d;

		getOrientation(field, a, b, c, d);
		return Common::UString::sprintf("%f/%f/%f/%f", a, b, c, d);
	}

	throw Common::Exception("Field is not a string(able) type");
}
Exemplo n.º 17
0
// -------------------------------------------------------------------
//  File parsing method.
void ObjFileParser::parseFile()
{
    if (m_DataIt == m_DataItEnd)
        return;

    // only update every 100KB or it'll be too slow
    const unsigned int updateProgressEveryBytes = 100 * 1024;
    unsigned int progressCounter = 0;
    const unsigned int bytesToProcess = std::distance(m_DataIt, m_DataItEnd);
    const unsigned int progressTotal = 3 * bytesToProcess;
    const unsigned int progressOffset = bytesToProcess;
    unsigned int processed = 0;

    DataArrayIt lastDataIt = m_DataIt;

    while (m_DataIt != m_DataItEnd)
    {
        // Handle progress reporting
        processed += std::distance(lastDataIt, m_DataIt);
        lastDataIt = m_DataIt;
        if (processed > (progressCounter * updateProgressEveryBytes))
        {
            progressCounter++;
            m_progress->UpdateFileRead(progressOffset + processed*2, progressTotal);
        }

        // parse line
        switch (*m_DataIt)
        {
        case 'v': // Parse a vertex texture coordinate
            {
                ++m_DataIt;
                if (*m_DataIt == ' ' || *m_DataIt == '\t') {
                    size_t numComponents = getNumComponentsInLine();
                    if (numComponents == 3) {
                        // read in vertex definition
                        getVector3(m_pModel->m_Vertices);
                    } else if (numComponents == 6) {
                        // read vertex and vertex-color
                        getTwoVectors3(m_pModel->m_Vertices, m_pModel->m_VertexColors);
                    }
                } else if (*m_DataIt == 't') {
                    // read in texture coordinate ( 2D or 3D )
                                        ++m_DataIt;
                                        getVector( m_pModel->m_TextureCoord );
                } else if (*m_DataIt == 'n') {
                    // Read in normal vector definition
                    ++m_DataIt;
                    getVector3( m_pModel->m_Normals );
                }
            }
            break;

        case 'p': // Parse a face, line or point statement
        case 'l':
        case 'f':
            {
                getFace(*m_DataIt == 'f' ? aiPrimitiveType_POLYGON : (*m_DataIt == 'l'
                    ? aiPrimitiveType_LINE : aiPrimitiveType_POINT));
            }
            break;

        case '#': // Parse a comment
            {
                getComment();
            }
            break;

        case 'u': // Parse a material desc. setter
            {
                getMaterialDesc();
            }
            break;

        case 'm': // Parse a material library or merging group ('mg')
            {
                if (*(m_DataIt + 1) == 'g')
                    getGroupNumberAndResolution();
                else
                    getMaterialLib();
            }
            break;

        case 'g': // Parse group name
            {
                getGroupName();
            }
            break;

        case 's': // Parse group number
            {
                getGroupNumber();
            }
            break;

        case 'o': // Parse object name
            {
                getObjectName();
            }
            break;

        default:
            {
                m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
            }
            break;
        }
    }
}
Exemplo n.º 18
0
bool PoseDetector::calcPose()
{
    try {
        Vector3D l_arm1, l_arm2;
        Vector3D r_arm1, r_arm2;
        
        Vector3D X_,Y_;
        
        //左手のベクトル
        l_arm1 = getVector(XN_SKEL_LEFT_SHOULDER,XN_SKEL_LEFT_ELBOW);
        l_arm2 = getVector(XN_SKEL_LEFT_ELBOW, XN_SKEL_LEFT_HAND);
        //右手のベクトル
        r_arm1 = getVector(XN_SKEL_RIGHT_SHOULDER, XN_SKEL_RIGHT_ELBOW);
        r_arm2 = getVector(XN_SKEL_RIGHT_ELBOW, XN_SKEL_RIGHT_HAND);
        
        //Y軸として首-頭 X軸として右肩-左肩
        X_ = getVector(XN_SKEL_LEFT_SHOULDER, XN_SKEL_RIGHT_SHOULDER);
        Y_ = getVector(XN_SKEL_NECK, XN_SKEL_HEAD);
        
        Vector3D l_arm,r_arm; //左右 肩-肘 肘-手 の平均ベクトル
        
        l_arm = (l_arm1 + l_arm2) / 2.0;
        r_arm = (r_arm1 + r_arm2) / 2.0;
        
        
        float l_cos_xz, l_cos_yz;
        // x-左腕平均 の角度
        l_cos_xz = (X_ * l_arm) / (X_.size() * l_arm.size());
        // y-左腕平均 の角度
        l_cos_yz = (Y_ * l_arm) / (Y_.size() * l_arm.size());
        
        float r_cos_xz, r_cos_yz;
        //x-右腕平均の角度
        r_cos_xz = (X_ * r_arm) / (X_.size() * r_arm.size());
        //y-右腕平均の角度
        r_cos_yz = (Y_ * r_arm) / (Y_.size() * r_arm.size());
        
        float l_arm_xz, l_arm_yz;
        //x-左肘から手 の角度
        l_arm_xz = (X_ * l_arm2) / (X_.size() * l_arm2.size());
        //y-左肘から手 の角度
        l_arm_yz = (Y_ * l_arm2) / (Y_.size() * l_arm2.size());
        
        float r_arm_xz, r_arm_yz;
        
        r_arm_xz = (X_ * r_arm2) / (Y_.size() * r_arm2.size());
        r_arm_yz = (Y_ * r_arm2) / (Y_.size() * r_arm2.size());
        
        bool front,back,left,right;
        
        
        
        front = (fabsf(r_cos_xz)< E_ &&  fabsf(l_cos_xz) < E_ && fabsf(r_cos_yz) < E_ && fabsf(l_cos_yz) < E_);
        
        back  = (fabsf(r_cos_xz) <E_ &&  fabsf(l_cos_xz) < E_ && (1.0-r_cos_yz) < E_ && (1.0 - l_cos_yz) < E_);
        
        left  = ((1.0+r_cos_xz) < E_ &&  (1.0+l_arm_xz) < E_ && fabsf(r_cos_yz) < E_ && fabsf(l_arm_yz)  < E_);
        
        right = ((1.0-r_arm_xz) < E_ &&  (1.0-l_cos_xz) < E_  && fabsf(r_arm_yz) < E_ && fabsf(l_cos_yz) < E_);
        
        
        
        if (!(front || back || left || right)){
            //Poseが検出されなかった場合の処理    
            if (posing) {
                //Poseが検出されている状態だった場合はPoseが終了したことを通知
                prevPoseName = poseName;
                posingTime = 0;
                lostPose(poseName);
                
            }
            posing = false;
            poseName = "stop";
            
        }else {
            
            prevPoseName = poseName;
            if(front){
                poseName = "front";
            }else if(back){
                poseName = "back";
            }else if(right){
                poseName = "right";
            }else if(left){
                poseName = "left";
            }
        }
        
    }catch(std::exception ex){
        return false;
    }
    
    return true;
}
Teuchos::RCP<LOCA::Hopf::MooreSpence::ExtendedVector>
LOCA::Hopf::MooreSpence::ExtendedMultiVector::getColumn(int i)
{
  return Teuchos::rcp_dynamic_cast<LOCA::Hopf::MooreSpence::ExtendedVector>(getVector(i),true);
}
Teuchos::RCP<const NOX::Abstract::Vector>
LOCA::Hopf::MooreSpence::ExtendedVector::getRealEigenVec() const
{
  return getVector(1);
}
Exemplo n.º 21
0
/*  python interface */
static PyObject* kernel_matrix(PyObject* self, PyObject* args){

  /* input variables */
  PyArrayObject *in_array;
  NpyIter *in_iter;
  NpyIter_IterNextFunc *in_iternext;
  PyObject *klargs;
  PyObject *seq;
  PyObject *item;
  double *data;
  char *kernel = (char*) malloc(20);
  double *kerargs;
  int rows, columns, len;

  /* python output variables */
  PyObject *np_matrix;
  double *matrix;
  double *xi, *xj;
  int vec_dim[1];
  int mat_dim[2];
  int i, j, itr = 0;

  /*  parse numpy array and two integers as argument */
  if (!PyArg_ParseTuple(args, "O!iis|O", 
                        &PyArray_Type, &in_array, // O!, NpArray
                        &rows,                    // i
                        &columns,                 // i
                        &kernel,                  // s, kernel
     /* kernel args */  &klargs)) return NULL;

  /***********************
  * Construct input data *
  ***********************/
  data = (double*) malloc(rows * columns * sizeof(double));
  /*  create the iterators, necessary to access numpy array */
  in_iter = NpyIter_New(in_array, NPY_ITER_READONLY, 
                        NPY_KEEPORDER, NPY_NO_CASTING, NULL);
  /* check input status */
  if (in_iter == NULL)
      goto fail;
  in_iternext = NpyIter_GetIterNext(in_iter, NULL);
  if (in_iternext == NULL) {
      NpyIter_Deallocate(in_iter);
      goto fail;
  }
  /* interator pointer to actual numpy data */
  double **in_dataptr = (double **) 
                           NpyIter_GetDataPtrArray(in_iter);
  /*  iterate over the arrays */
  do {
      data[itr++] = **in_dataptr;
  } while(in_iternext(in_iter));

  /* access python list data */
  seq = PySequence_Fast(klargs, "expected a sequence");
  len = PySequence_Size(klargs);
  kerargs = (double*) malloc(len * sizeof(double));
  for(i=0;i<len;i++){
    item = PySequence_Fast_GET_ITEM(seq, i);
    kerargs[i] = PyFloat_AsDouble(item);
  }
  Py_DECREF(seq);
  /***** end of input data construction *****/

  /**************************
  * construct output matrix *
  **************************/
  matrix = (double *) malloc(rows * rows * sizeof(double));
  mat_dim[0] = rows;
  mat_dim[1] = rows;
  vec_dim[0] = columns;

#pragma omp parallel private(i,j,xi,xj) shared(matrix)
{
  #pragma omp for
  for(i=0;i<rows;i++){
    for(j=i;j<rows;j++){
      xi = (double*) malloc(columns * sizeof(double));
      xj = (double*) malloc(columns * sizeof(double));
      /* construct callback input numpy arrays*/
      getVector(xi, data, i, columns);
      getVector(xj, data, j, columns);
      matrix[j+rows*i] = kerEval(kernel,kerargs,xi,xj,columns);
      if(i!=j) matrix[i+rows*j] = matrix[j+rows*i];
      free(xi);
      free(xj);
    }
  }
}
  np_matrix = PyArray_SimpleNewFromData(2, mat_dim, 
                                        NPY_DOUBLE, matrix);
  /***** end of output matrix construction *****/

  /*********************************
  * clean up and return the result *
  *********************************/
  Py_INCREF(np_matrix);
  return np_matrix;
  NpyIter_Deallocate(in_iter);

  /*  in case bad things happen */
  fail:
      Py_XDECREF(np_matrix);
      return NULL;

  free(data);
  free(matrix);
}
Exemplo n.º 22
0
/***
Creates a chunk at (chunk_x,chunk_y,chunk_z) in chunk coordinates.
Allocations:
 - pos: position of chunk in real coordinates
 - sn: chunk's scenenode
 - mo: chunk's mesh (manualobject)
 - vertices: memoization of mesh's vertices
 - trimesh: holds triangle data for bullet
 - tms: collision shape using trimesh
 - ms: motion state
 - rb: chunk's rigidbody

***/
void ChunkManager::createChunk(int chunk_x, int chunk_y, int chunk_z) {
    if (hasChunkAtChunkCoords(chunk_x, chunk_y, chunk_z)) {
        // Don't do anything if we already have a chunk there.
        return;
    }
    mName = new Ogre::String("Chunk_"+Ogre::StringConverter::toString(chunk_x)+"_"+Ogre::StringConverter::toString(chunk_y)+"_"+Ogre::StringConverter::toString(chunk_z));
    Ogre::Vector3 pos = chunkToRealCoords(chunk_x,chunk_y,chunk_z);
    Ogre::SceneNode* sn = mGame->createSceneNode(pos);
    clock_t t;
    Game::log(TAG, "Creating chunk...");
    t = clock();
    Landscape* landscape = mGame->getLandscape();
    Ogre::ManualObject* mo = new Ogre::ManualObject("ChunkManualObject" + *mName);

    /*** The following code is to memoize the mesh creation process. I don't know if it will make things faster (most likely will), but
    I'll keep it here for now to test later in case the speed of this function is slow.***/

    Ogre::Vector3** vertices = new Ogre::Vector3* [(SIZES::CHUNK_SIZE+2)*(SIZES::CHUNK_SIZE+2)]; // + 2 to account for the edge vertices

    for (int i = 0; i < (SIZES::CHUNK_SIZE+2)*(SIZES::CHUNK_SIZE+2); i++) {
        vertices[i] = NULL;
    }

    // Create the meshes
    //mo->begin("Astral/Grass");
    mo->begin("Examples/GrassFloor");
    for (int x = 0; x < SIZES::CHUNK_SIZE; x++) {
        for (int z = 0; z < SIZES::CHUNK_SIZE; z++) {
            // vx, vy, vz define the next vertex we want to add to the manualobject.
            int vx = x + pos.x;
            int vz = z + pos.z;
            Ogre::Vector3 v = *getVector(vx,vz,landscape,vertices);
            // add the vertex
            mo->position(v);

            // now we need to find the faces this vertex touches
            Ogre::Vector3 ll = *getVector(vx-1,vz-1,landscape,vertices);
            Ogre::Vector3 lm = *getVector(vx,vz-1,landscape,vertices);
            Ogre::Vector3 lr = *getVector(vx+1,vz-1,landscape,vertices);
            Ogre::Vector3 ml = *getVector(vx-1,vz,landscape,vertices);
            Ogre::Vector3 mr = *getVector(vx+1,vz,landscape,vertices);
            Ogre::Vector3 ul = *getVector(vx-1,vz+1,landscape,vertices);
            Ogre::Vector3 um = *getVector(vx,vz+1,landscape,vertices);
            Ogre::Vector3 ur = *getVector(vx+1,vz+1,landscape,vertices);


            Ogre::Vector3 normal = Ogre::Vector3(0,0,0);

            normal += (v - ll).crossProduct(lm - ll).normalisedCopy();
            normal += (ml - ll).crossProduct(v - ll).normalisedCopy();
            normal += (um - ml).crossProduct(v - ml).normalisedCopy();
            normal += (ul - ml).crossProduct(um - ml).normalisedCopy();
            normal += (um - v).crossProduct(ur - v).normalisedCopy();
            normal += (ur - v).crossProduct(mr - v).normalisedCopy();
            normal += (v - lm).crossProduct(mr - lm).normalisedCopy();
            normal += (mr - lm).crossProduct(lr - lm).normalisedCopy();

            mo->normal(normal.normalisedCopy());

            mo->textureCoord((float)x/(float)SIZES::CHUNK_TEXTURE_TILE,(float)z/(float)SIZES::CHUNK_TEXTURE_TILE);

        }
    }
    Game::log(TAG, "Vertices created");

    btTriangleMesh* trimesh = new btTriangleMesh();
    for (int x = 0; x < SIZES::CHUNK_SIZE - 1; x++) {
        for (int z = 0; z < SIZES::CHUNK_SIZE - 1; z++) {
            mo->triangle((x * SIZES::CHUNK_SIZE) + z + 1,
                         ((x + 1) * SIZES::CHUNK_SIZE) + z,
                         (x * SIZES::CHUNK_SIZE) + z);

            mo->triangle((x * SIZES::CHUNK_SIZE) + z + 1,
                         ((x + 1) * SIZES::CHUNK_SIZE) + z + 1,
                         ((x + 1) * SIZES::CHUNK_SIZE) + z);

            Ogre::Vector3* a = vertices[(x+1)*(SIZES::CHUNK_SIZE+2)+z+2];
            Ogre::Vector3* b = vertices[(x+2)*(SIZES::CHUNK_SIZE+2)+z+1];
            Ogre::Vector3* c = vertices[(x+1)*(SIZES::CHUNK_SIZE+2)+z+1];
            Ogre::Vector3* d = vertices[(x+2)*(SIZES::CHUNK_SIZE+2)+z+2];
            trimesh->addTriangle(btVector3(a->x,a->y,a->z),
                                 btVector3(b->x,b->y,b->z),
                                 btVector3(c->x,c->y,c->z));
            trimesh->addTriangle(btVector3(a->x,a->y,a->z),
                                 btVector3(d->x,d->y,d->z),
                                 btVector3(b->x,b->y,b->z));
        }
    }
    mo->end();
    sn->attachObject(mo);
    Game::log(TAG, "mo attached");

    btBvhTriangleMeshShape* tms = new btBvhTriangleMeshShape(trimesh,
                                                             true); //useQuantizedAabbCompression
//    btShapeHull* hull = new btShapeHull(tms);
//    btScalar margin = tms->getMargin();
//    hull->buildHull(margin);
//    btConvexHullShape* chs = new btConvexHullShape((btScalar*)hull->getVertexPointer(), hull->numVertices());
    // I give it this motionstate and not an Ogre one because chunks shouldn't move anyways
    btDefaultMotionState* ms = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(pos.x,pos.y,pos.z)));
    btRigidBody::btRigidBodyConstructionInfo info(0,ms,tms);
    btRigidBody* rb = new btRigidBody(info);
    Game::log(TAG, "rb created");

    mGame->addRigidBody(rb);
    Game::log(TAG, "rb added");

    // Clean up
    for (int i = 0; i < (SIZES::CHUNK_SIZE+2)*(SIZES::CHUNK_SIZE+2); i++) {
        delete vertices[i];
    }
    delete [] vertices;

    // Time stats
    t = clock() - t;
    Game::log(TAG, "Done creating chunk mesh.");
    Game::log(TAG, "Mesh created in "+Ogre::StringConverter::toString((long)t)+" ticks.");
    mChunks[chunk_x][chunk_y][chunk_z] = new Chunk(sn, mo, trimesh, tms, ms, rb);
}
Exemplo n.º 23
0
//-------------------------------------------------------------------------------------
PyObject* ScriptVector3::pyGetVectorLengthSquared()
{ 
	return PyFloat_FromDouble(KBEVec3LengthSq(&getVector()));
}
Exemplo n.º 24
0
void MiniBoss01::adjustPosition() {
    m_position[0] = getVector(position.x, position.y + 45.0f);
    m_position[1] = getVector(position.x - 30.0f, position.y);
    m_position[2] = getVector(position.x + 30.0f, position.y);
}
Exemplo n.º 25
0
//-------------------------------------------------------------------------------------
int ScriptVector3::pySetZ(PyObject *value)
{
	getVector().z = float(PyFloat_AsDouble(value)); 
	onPyPositionChanged();
	return 0; 
}
Exemplo n.º 26
0
//-------------------------------------------------------------------------------------
PyObject* ScriptVector4::pyGetW()
{
	return PyFloat_FromDouble(getVector().w); 
}
Exemplo n.º 27
0
Common::UString GFF3Struct::getString(const Common::UString &field,
                                      const Common::UString &def) const {

	const Field *f = getField(field);
	if (!f)
		return def;

	if (f->type == kFieldTypeExoString) {
		Common::SeekableReadStream &data = getData(*f);

		const uint32 length = data.readUint32LE();
		return Common::readStringFixed(data, Common::kEncodingASCII, length);
	}

	if (f->type == kFieldTypeResRef) {
		Common::SeekableReadStream &data = getData(*f);

		const uint32 length = data.readByte();
		return Common::readStringFixed(data, Common::kEncodingASCII, length);
	}

	if (f->type == kFieldTypeLocString) {
		LocString locString;
		getLocString(field, locString);

		return locString.getString();
	}

	if ((f->type == kFieldTypeByte  ) ||
	    (f->type == kFieldTypeUint16) ||
	    (f->type == kFieldTypeUint32) ||
	    (f->type == kFieldTypeUint64) ||
	    (f->type == kFieldTypeStrRef)) {

		return Common::composeString(getUint(field));
	}

	if ((f->type == kFieldTypeChar  ) ||
	    (f->type == kFieldTypeSint16) ||
	    (f->type == kFieldTypeSint32) ||
	    (f->type == kFieldTypeSint64)) {

		return Common::composeString(getSint(field));
	}

	if ((f->type == kFieldTypeFloat) ||
	    (f->type == kFieldTypeDouble)) {

		return Common::composeString(getDouble(field));
	}

	if (f->type == kFieldTypeVector) {
		float x = 0.0, y = 0.0, z = 0.0;

		getVector(field, x, y, z);
		return Common::composeString(x) + "/" +
		       Common::composeString(y) + "/" +
		       Common::composeString(z);
	}

	if (f->type == kFieldTypeOrientation) {
		float a = 0.0, b = 0.0, c = 0.0, d = 0.0;

		getOrientation(field, a, b, c, d);
		return Common::composeString(a) + "/" +
		       Common::composeString(b) + "/" +
		       Common::composeString(c) + "/" +
		       Common::composeString(d);
	}

	throw Common::Exception("GFF3: Field is not a string(able) type");
}