bool CommandLineArguments::SetOutputType(int ac, const char** av, int& i)
{
	SimpleString outputType = getParameterField(ac, av, i);
	if (outputType.size() == 0) return false;

	if (outputType == "normal" || outputType == "eclipse") {
		outputType_ = OUTPUT_ECLIPSE;
		return true;
	}
	if (outputType == "junit") {
		outputType_ = OUTPUT_JUNIT;
		return true;
	}
	return false;
}
Exemplo n.º 2
0
void
Material::setValue(char* data_string) {

  Parameter::setValue(data_string);

  // Check status (must have Density!)
  status = STATUS_OK;

#if 0
  if ( NULL == getParameterField(EFN_DENSITY) ){
    status = MATERIAL_DENSITY_MISSING;
  }
#endif

}
Exemplo n.º 3
0
void AnchorNode::outputContext(ostream &printStream, const char *indentString) 
{
	SFString *description = getDescriptionField();
	printStream << indentString << "\t" << "description " << description << endl;
	
	if (0 < getNParameters()) {
		MFString *parameter = getParameterField();
		printStream << indentString << "\t" << "parameter ["  << endl;
		parameter->MField::outputContext(printStream, indentString, "\t\t");
		printStream << indentString << "\t" << "]" << endl;
	}

	if (0 < getNUrls()) {
		MFString *url = getUrlField();
		printStream << indentString << "\t" << "url [" << endl;
		url->MField::outputContext(printStream, indentString, "\t\t");
		printStream << indentString << "\t" << "]" << endl;
	}
}
Exemplo n.º 4
0
const char *AnchorNode::getParameter(int index) 
{
	return getParameterField()->get1Value(index);
}
Exemplo n.º 5
0
int AnchorNode::getNParameters() 
{
	return getParameterField()->getSize();
}
Exemplo n.º 6
0
void AnchorNode::addParameter(const char *value) 
{
	getParameterField()->addValue(value);
}
Exemplo n.º 7
0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
  /* matlab usage: pdos(data,cone,params); */
  Data *d; 
  Cone *k;
  const Sol *sol;

  const mxArray *data;
  const mxArray *A_mex;
  const mxArray *b_mex;
  const mxArray *c_mex;

  const mxArray *f_mex;
  const mxArray *l_mex;
  const mxArray *q_mex;
  const double *q_mex_vals;

  const mxArray *x0;
  const mxArray *y0;
  const mxArray *s0;

  const mxArray *cone;
  const mxArray *params;

  idxint i;

  if (nrhs != 3){
    mexErrMsgTxt("Three arguments are required in this order: data struct, cone struct, params struct");
  }

  if (nlhs > 4) {
    mexErrMsgTxt("PDOS has up to 4 output arguments only.");
  }
  
  d = mxMalloc(sizeof(Data)); 
  k = mxMalloc(sizeof(Cone));
  d->p = mxMalloc(sizeof(Params));

  data = prhs[0];
  cone = prhs[1];
  params = prhs[2];

  A_mex = (mxArray *) mxGetField(data,0,"A");
  if(A_mex == NULL) {
    mxFree(d->p); mxFree(d); mxFree(k);
    mexErrMsgTxt("Data struct must contain a `A` entry.");
  }
  if (!mxIsSparse(A_mex)){
    mxFree(d->p); mxFree(d); mxFree(k);
    mexErrMsgTxt("Input matrix A must be in sparse format (pass in sparse(A))");
  }
  if (mxIsComplex(A_mex)) {
    mxFree(d->p); mxFree(d); mxFree(k);
    mexErrMsgTxt("Input matrix A cannot be complex");
  }
  
  b_mex = (mxArray *) mxGetField(data,0,"b");
  if(b_mex == NULL) {
    mxFree(d->p); mxFree(d); mxFree(k);
    mexErrMsgTxt("Data struct must contain a `b` entry.");
  }
  if(mxIsSparse(b_mex)) {
    mxFree(d->p); mxFree(d); mxFree(k);
    mexErrMsgTxt("Input vector b must be dense (pass in full(b))");
  }
  if (mxIsComplex(b_mex)) {
    mxFree(d->p); mxFree(d); mxFree(k);
    mexErrMsgTxt("Input vector b cannot be complex");
  }
  
  c_mex = (mxArray *) mxGetField(data,0,"c"); 
  if(c_mex == NULL) {
    mxFree(d->p); mxFree(d); mxFree(k);
    mexErrMsgTxt("Data struct must contain a `c` entry.");
  }
  if(mxIsSparse(c_mex)) {
    mxFree(d->p); mxFree(d); mxFree(k);
    mexErrMsgTxt("Input vector c must be dense (pass in full(c))");
  }
  if (mxIsComplex(c_mex)) {
    mxFree(d->p); mxFree(d); mxFree(k);
    mexErrMsgTxt("Input vector c cannot be complex");
  }
  
  x0 = (mxArray *) mxGetField(data,0,"x0");   
  if(x0 != NULL && mxIsSparse(x0)) {
    mxFree(d->p); mxFree(d); mxFree(k);
    mexErrMsgTxt("Initial vector x0 must be dense (pass in full(x0))");
  }
  if (x0 != NULL && mxIsComplex(x0)) {
    mxFree(d->p); mxFree(d); mxFree(k);
    mexErrMsgTxt("Initial vector x0 cannot be complex");
  }
  
  y0 = (mxArray *) mxGetField(data,0,"y0"); 
  if(y0 != NULL && mxIsSparse(y0)) {
    mxFree(d->p); mxFree(d); mxFree(k);
    mexErrMsgTxt("Initial vector y0 must be dense (pass in full(y0))");
  }
  if (y0 != NULL && mxIsComplex(y0)) {
    mxFree(d); mxFree(k);
    mexErrMsgTxt("Initial vector y0 cannot be complex");
  }

  s0 = (mxArray *) mxGetField(data,0,"s0"); 
  if(s0 != NULL && mxIsSparse(s0)) {
    mxFree(d); mxFree(k);
    mexErrMsgTxt("Initial vector s0 must be dense (pass in full(s0))");
  }
  if (s0 != NULL && mxIsComplex(s0)) {
    mxFree(d); mxFree(k);
    mexErrMsgTxt("Initial vector s0 cannot be complex");
  }
  
  d->n = getVectorLength(c_mex,"data.c");
  d->m = getVectorLength(b_mex,"data.b");

  d->b = mxGetPr(b_mex);
  d->c = mxGetPr(c_mex);
  
  d->x = x0 ? mxGetPr(x0) : NULL;
  d->y = y0 ? mxGetPr(y0) : NULL;
  d->s = s0 ? mxGetPr(s0) : NULL;
  
  d->p->ALPHA = getParameterField(params, "ALPHA", d, k);
  d->p->MAX_ITERS = (idxint)getParameterField(params, "MAX_ITERS", d, k);
  
  d->p->EPS_ABS = getParameterField(params, "EPS_ABS", d, k);

  d->p->CG_MAX_ITS = (idxint)getParameterField(params, "CG_MAX_ITS", d, k);
  d->p->CG_TOL = getParameterField(params, "CG_TOL", d, k);
  d->p->VERBOSE = (idxint)getParameterField(params, "VERBOSE", d, k);
  d->p->NORMALIZE = (idxint)getParameterField(params, "NORMALIZE", d, k);


  f_mex = (mxArray *) mxGetField(cone,0,"f"); 
  if(f_mex == NULL) {
    mxFree(d); mxFree(k);
    mexErrMsgTxt("Cone struct must contain a `f` entry.");
  }
  k->f = (idxint)*mxGetPr(f_mex);
  
  l_mex = (mxArray *) mxGetField(cone,0,"l"); 
  if(l_mex == NULL) {
    mxFree(d); mxFree(k);
    mexErrMsgTxt("Cone struct must contain a `l` entry.");
  }
  k->l = (idxint)*mxGetPr(l_mex);
  
  q_mex = (mxArray *) mxGetField(cone,0,"q"); 
  if(q_mex == NULL) {
    mxFree(d); mxFree(k);
    mexErrMsgTxt("Cone struct must contain a `q` entry.");
  }
  
  q_mex_vals = mxGetPr(q_mex);
  k->qsize = getVectorLength(mxGetField(cone,0,"q"), "cone.q");
  
  k->q = mxMalloc(sizeof(idxint)*k->qsize);
  for ( i=0; i < k->qsize; i++ ){
    k->q[i] = (idxint)q_mex_vals[i]; 
  }
  
  /* int Anz = mxGetNzmax(A_mex); */
  d->Ax = (double *)mxGetPr(A_mex);
  d->Ai = (long*)mxGetIr(A_mex);
  d->Ap = (long*)mxGetJc(A_mex);

  /* printConeData(d,k); */
  /* printData(d); */
  
  sol = pdos(d,k);
  
  plhs[0] = mxCreateDoubleMatrix(d->n, 1, mxREAL);
  mxSetPr(plhs[0], sol->x);
  
  plhs[1] = mxCreateDoubleMatrix(d->m, 1, mxREAL);
  mxSetPr(plhs[1], sol->s);

  plhs[2] = mxCreateDoubleMatrix(d->m, 1, mxREAL);
  mxSetPr(plhs[2], sol->y);

  plhs[3] = mxCreateString(sol->status);
  
  mxFree(d->p); mxFree(d); mxFree(k->q); mxFree(k);
    
  return; 
}
void CommandLineArguments::SetNameFilter(int ac, const char** av, int& i)
{
	nameFilter_ = getParameterField(ac, av, i);
}
void CommandLineArguments::SetGroupFilter(int ac, const char** av, int& i)
{
	SimpleString gf = getParameterField(ac, av, i);
	groupFilter_ = gf;
}