void sendRenderData(magnet::GL::Context& context) { context.getCLCommandQueue().enqueueWriteBuffer (getPointData(), false, 0, 3 * _N * sizeof(cl_float), &_particleData[0]); context.getCLCommandQueue().enqueueWriteBuffer (getDirectionData(), false, 0, 3 * _N * sizeof(cl_float), &_particleData[3 * _N]); }
void sendRenderData(magnet::CL::CLGLState& CLState) { CLState.getCommandQueue().enqueueWriteBuffer (getPointData(), false, 0, 3 * _N * sizeof(cl_float), &_particleData[0]); CLState.getCommandQueue().enqueueWriteBuffer (getDirectionData(), false, 0, 3 * _N * sizeof(cl_float), &_particleData[3 * _N]); }
XMLInputReader::XMLInputReader(std::string filename) { XMLdoc = new tinyxml2::XMLDocument(); targetView = -1; targetWidth = 0.0; targetHeight = 0.0; createImages = false; inputXMLFile = filename; if (XMLdoc->LoadFile(filename.c_str()) == tinyxml2::XML_SUCCESS) { tinyxml2::XMLElement *pRoot, *pParm; pRoot = XMLdoc->FirstChildElement("SEGMENTATION"); if (pRoot == NULL) { std::cout << "The input xml file does not have element SEGMENTATION " << filename << std::endl; throw -1; } if (pRoot) { outputDirectory = std::string("NOT FOUND"); modelName = std::string("NOT_FOUND"); pParm = pRoot->FirstChildElement("OUTPUTDIRECTORY"); if (pParm) { outputDirectory = std::string(pParm->GetText()); const char* attr = pParm->Attribute("JPEGS"); if (attr != NULL) { if (std::string(attr) == "TRUE" || std::string(attr) == "true") { createImages = true; } } } pParm = pRoot->FirstChildElement("MODELNAME"); if (pParm) { modelName = std::string(pParm->GetText()); } pParm = pRoot->FirstChildElement("NUMBEROFFRAMES"); numberOfFrames = maxcapframes; if (pParm) { numberOfFrames = atoi(pParm->GetText()); } pParm = pRoot->FirstChildElement("TARGETHEIGHT"); if (pParm) { targetHeight = atof(pParm->GetText()); } pParm = pRoot->FirstChildElement("TARGETWIDTH"); if (pParm) { targetWidth = atof(pParm->GetText()); } pParm = pRoot->FirstChildElement("TARGETVIEW"); if (pParm) { targetView = std::string(pParm->GetText()); } pParm = pRoot->FirstChildElement("BASE"); if (pParm) { double * b = getPointData(pParm); base[0] = b[0]; base[1] = b[1]; base[2] = b[2]; delete[] b; } pParm = pRoot->FirstChildElement("APEX"); if (pParm) { double * a = getPointData(pParm); apex[0] = a[0]; apex[1] = a[1]; apex[2] = a[2]; delete[] a; } pParm = pRoot->FirstChildElement("RVINSERTS"); if (pParm) { tinyxml2::XMLNode* child = pParm->FirstChild(); while (child != 0) { double* rvInsert = getPointData(child->ToElement()); rvInserts.push_back(rvInsert); child = child->NextSibling(); } } pParm = pRoot->FirstChildElement("MARKERS"); //Returns all xml elements from the first element names MARKERS for (; pParm; pParm = pParm->NextSiblingElement()) { if (std::string(pParm->Name()) != "MARKERS") { continue; //Only process if the tag is of type "MARKERS" } try { bool edset = false; bool ecset = false; std::string viewType = boost::to_upper_copy(std::string(pParm->Attribute("VIEW"))); std::string markerType("ENDO"); if (pParm->Attribute("TYPE")) { markerType = boost::to_upper_copy(std::string(pParm->Attribute("TYPE"))); } std::string recordType = viewType + markerType; this->viewType[recordType] = viewType; this->markerType[recordType] = markerType; if (pParm->Attribute("ED")) { ed[recordType] = atoi(pParm->Attribute("ED")); edset = true; } if (pParm->Attribute("EC")) { ec[recordType] = atoi(pParm->Attribute("EC")); ecset = true; } if (pParm->Attribute("BPM")) { bpm[recordType] = (double) atof(pParm->Attribute("BPM")); ecset = true; } if (edset) { if (!ecset) std::cout << " EC has not been set for " << recordType << " program may fail" << std::endl; } if (ecset) { if (!edset) std::cout << " ED has not been set for " << recordType << " program may fail" << std::endl; } tinyxml2::XMLElement* uri = pParm->FirstChildElement("URI"); if (uri) { fileuri[recordType] = std::string(uri->GetText()); } else { std::ostringstream ss; ss << "FATAL: No URI associated with view " << viewType << " marker type " << markerType; throw SegmentationAndFittingException(ss.str()); } std::vector<double*> fmarkers(100); //Resize to correct no of markers tinyxml2::XMLElement* child = pParm->FirstChildElement("MARKS"); int ctr = 0; while (child != 0) { if (std::string(child->Name()) == "MARKS"){ int myID = -1; //marker ids start from 1 child->QueryIntAttribute("ID", &myID); if (myID > -1) { double* point = getPointData(child); fmarkers[myID] = point; ctr++; } else { std::cout << "Failed to load the node "<< std::cout; fflush(stdout); } } child = child->NextSiblingElement(); } fmarkers.resize(ctr + 1); markers[recordType] = fmarkers; //Check if ESframe information is available and if so load it child = pParm->FirstChildElement("ESFRAME"); if(child!=0){ int esframe = -1; child->QueryIntAttribute("ESFRAMENO", &esframe); std::vector<double*> baseplane(2); tinyxml2::XMLElement* fchild = child->FirstChildElement("MARKS"); while (fchild != 0) { if (std::string(fchild->Name()) == "MARKS"){ int myID = -1; //marker ids start from 1 fchild->QueryIntAttribute("ID", &myID); if (myID > -1) { double* point = getPointData(fchild); baseplane[myID-1] = point; } else { std::cout << "Failed to load the node " << std::cout; fflush(stdout); } } fchild = fchild->NextSiblingElement(); } es[recordType] = esframe; esbaseplane[recordType] = baseplane; } #ifdef debug std::cout<<"Markers for "<<viewType<<"\t"; for(int i=1;i<ctr;i++) { std::cout<<fmarkers[i][0]<<" ,"<<fmarkers[i][1]<<" "; } std::cout<<std::endl; #endif } catch (std::exception& ex) { std::cout << " The input xml file does not seem to be in the appropriate format "; std::cout << ex.what(); throw ex; } } } } else { std::cout << "Unable to load the input file " << filename << std::endl; throw -1; } }
Vector3r TraceVisRep::pyPt_get(int i) const { Vector3r pt; Real scalar; bool ok=getPointData(pyIndexConvert(i,"point"),pt,scalar); if(!ok) throw std::logic_error("TraceVisRep::pyPt_get: getPointData error for i="+to_string(i)+"?"); return pt; }
vector<Real> TraceVisRep::pyScalars_get() const{ size_t i=0; vector<Real> ret; ret.reserve(countPointData()); Vector3r pt; Real scalar; while(getPointData(i++,pt,scalar)) ret.push_back(scalar); return ret; }