SEXP getPM2(SEXP eig, SEXP nc, SEXP el, SEXP w){ R_len_t i, j, nel, nw; int m=INTEGER(nc)[0], l=0; double *ws=REAL(w); double *edgelen=REAL(el); double *eva, *eve, *evei; SEXP P, RESULT; nel = length(el); nw = length(w); if(!isNewList(eig)) error("'eig' must be a list"); eva = REAL(VECTOR_ELT(eig, 0)); eve = REAL(VECTOR_ELT(eig, 1)); evei = REAL(VECTOR_ELT(eig, 2)); PROTECT(RESULT = allocVector(VECSXP, nel*nw)); for(j=0; j<nel; j++){ for(i=0; i<nw; i++){ PROTECT(P = allocMatrix(REALSXP, m, m)); getPP(eva, eve, evei, m, edgelen[j], ws[i], REAL(P)); SET_VECTOR_ELT(RESULT, l, P); UNPROTECT(1); l++; } } UNPROTECT(1);//RESULT return(RESULT); }
bool Mesh::saveStl(const char* filename) const { FILE* fp = fopen(filename,"w+"); if (fp==NULL) return false; std::cout<<"Writing Stl file "<<filename<<std::endl; //bool res = saveStl(fp); fprintf(fp,"solid mesh\n"); for (int i=0;i<nbf();i++) { fprintf(fp,"face normal %f %f %f\n",getFN(i)[0],getFN(i)[1],getFN(i)[2]); fprintf(fp," outer loop\n"); for (int j=0;j<3;j++) { int p = getFP(i)[j]; fprintf(fp," vertex %f %f %f\n",getPP(p)[0],getPP(p)[1],getPP(p)[2]); } fprintf(fp,"endloop\n"); fprintf(fp,"endfacet\n"); } fclose(fp); return true; }
Indicator * PP::calculate () { Indicator *output = new Indicator; output->setDateFlag(dateFlag); output->setLogScale(logScale); QPtrList<PlotLine> pll; pll.setAutoDelete(FALSE); getPP(pll); int loop; for (loop = 0; loop < (int) pll.count(); loop++) output->addLine(pll.at(loop)); return output; }
PlotLine * PP::calculateCustom (QString &p, QPtrList<PlotLine> &d) { // format1: PP_TYPE if (checkFormat(p, d, 1, 1)) return 0; int t = ppList.findIndex(formatStringList[0]); if (t == -1) { qDebug("PP::calculateCustom: invalid PP_TYPE parm"); return 0; } QPtrList<PlotLine> pll; pll.setAutoDelete(TRUE); getPP(pll); PlotLine *line = new PlotLine; PlotLine *tline = pll.at(t); line->copy(tline); return line; }