void OrientedGrowthPlugin::update(CC3DXMLElement *_xmlData, bool _fullInitFlag){ //PARSE XML IN THIS FUNCTION //For more information on XML parser function please see CC3D code or lookup XML utils API automaton = potts->getAutomaton(); ASSERT_OR_THROW("CELL TYPE PLUGIN WAS NOT PROPERLY INITIALIZED YET. MAKE SURE THIS IS THE FIRST PLUGIN THAT YOU SET", automaton) set<unsigned char> cellTypesSet; CC3DXMLElement * myElementOne = xmlData->getFirstElement("Penalty"); if(myElementOne){ xml_energy_penalty = myElementOne->getDouble(); }else{ xml_energy_penalty = 99999; } CC3DXMLElement * myElementTwo = xmlData->getFirstElement("Falloff"); if(myElementTwo){ xml_energy_falloff = myElementTwo->getDouble(); }else{ xml_energy_falloff = 1; } //boundaryStrategy has information aobut pixel neighbors boundaryStrategy=BoundaryStrategy::getInstance(); }
void ConnectivityGlobalPlugin::update(CC3DXMLElement *_xmlData, bool _fullInitFlag) { if (potts->getDisplayUnitsFlag()) { Unit energyUnit = potts->getEnergyUnit(); CC3DXMLElement * unitsElem = _xmlData->getFirstElement("Units"); if (!unitsElem) { //add Units element unitsElem = _xmlData->attachElement("Units"); } if (unitsElem->getFirstElement("PenaltyUnit")) { unitsElem->getFirstElement("PenaltyUnit")->updateElementValue(energyUnit.toString()); } else { CC3DXMLElement * energyElem = unitsElem->attachElement("PenaltyUnit", energyUnit.toString()); } } penaltyVec.clear(); Automaton *automaton = potts->getAutomaton(); ASSERT_OR_THROW("CELL TYPE PLUGIN WAS NOT PROPERLY INITIALIZED YET. MAKE SURE THIS IS THE FIRST PLUGIN THAT YOU SET", automaton) set<unsigned char> cellTypesSet; map<unsigned char, double> typeIdConnectivityPenaltyMap; if (_xmlData->getFirstElement("DoNotPrecheckConnectivity")) { doNotPrecheckConnectivity = true; } if (_xmlData->getFirstElement("FastAlgorithm")) { fast_algorithm = true; changeEnergyFcnPtr = &ConnectivityGlobalPlugin::changeEnergyFast; } CC3DXMLElementList penaltyVecXML = _xmlData->getElements("Penalty"); CC3DXMLElementList connectivityOnVecXML = _xmlData->getElements("ConnectivityOn"); ASSERT_OR_THROW("You cannot use Penalty and ConnectivityOn tags together. Stick to one convention", !(connectivityOnVecXML.size() && penaltyVecXML.size())); // previous ASSERT_OR_THROW will encure that only one of the subsequent for loops be executed for (int i = 0; i < penaltyVecXML.size(); ++i) { typeIdConnectivityPenaltyMap.insert(make_pair(automaton->getTypeId(penaltyVecXML[i]->getAttribute("Type")), penaltyVecXML[i]->getDouble())); //inserting all the types to the set (duplicate are automatically eleminated) to figure out max value of type Id cellTypesSet.insert(automaton->getTypeId(penaltyVecXML[i]->getAttribute("Type"))); } for (int i = 0; i < connectivityOnVecXML.size(); ++i) { typeIdConnectivityPenaltyMap.insert(make_pair(automaton->getTypeId(connectivityOnVecXML[i]->getAttribute("Type")), 1.0)); //inserting all the types to the set (duplicate are automatically eleminated) to figure out max value of type Id cellTypesSet.insert(automaton->getTypeId(connectivityOnVecXML[i]->getAttribute("Type"))); } //Now that we know all the types used in the simulation we will find size of the penaltyVec vector<unsigned char> cellTypesVector(cellTypesSet.begin(), cellTypesSet.end());//coping set to the vector int size = 0; if (cellTypesVector.size()) { size = *max_element(cellTypesVector.begin(), cellTypesVector.end()); } maxTypeId = size; size += 1;//if max element is e.g. 5 then size has to be 6 for an array to be properly allocated int index; penaltyVec.assign(size, 0.0); //inserting connectivity penalty values to penaltyVec; for (map<unsigned char, double>::iterator mitr = typeIdConnectivityPenaltyMap.begin(); mitr != typeIdConnectivityPenaltyMap.end(); ++mitr) { penaltyVec[mitr->first] = fabs(mitr->second); } cerr << "size=" << size << endl; for (int i = 0; i < size; ++i) { cerr << "penaltyVec[" << i << "]=" << penaltyVec[i] << endl; } //Here I initialize max neighbor index for direct acces to the list of neighbors boundaryStrategy = BoundaryStrategy::getInstance(); maxNeighborIndex = 0; maxNeighborIndex = boundaryStrategy->getMaxNeighborIndexFromNeighborOrder(1); cerr << "ConnectivityGlobal maxNeighborIndex=" << maxNeighborIndex << endl; WatchableField3D<CellG *> *cellFieldG = (WatchableField3D<CellG *> *)potts->getCellFieldG(); Dim3D fieldDim = cellFieldG->getDim(); // max_neighbor_index_local_search is different depending whether we are on hex or cartesian lattice and if this is 2D or 3D simulation if (boundaryStrategy->getLatticeType() == HEXAGONAL_LATTICE) { // on hex lattice in 2D and 3D nearest neighbors "completely cover" a given pixel max_neighbor_index_local_search = boundaryStrategy->getMaxNeighborIndexFromNeighborOrder(1); } else { if (fieldDim.x == 1 || fieldDim.y == 1 || fieldDim.z == 1) { //2D simulation max_neighbor_index_local_search = boundaryStrategy->getMaxNeighborIndexFromNeighborOrder(2); } else { //3D max_neighbor_index_local_search = boundaryStrategy->getMaxNeighborIndexFromNeighborOrder(3); } } }
void AdhesionFlexPlugin::update(CC3DXMLElement *_xmlData, bool _fullInitFlag){ automaton = potts->getAutomaton(); ASSERT_OR_THROW("CELL TYPE PLUGIN WAS NOT PROPERLY INITIALIZED YET. MAKE SURE THIS IS THE FIRST PLUGIN THAT YOU SET", automaton) set<unsigned char> cellTypesSet; //scanning Adhesion Molecule names CC3DXMLElementList adhesionMoleculeNameXMLVec=_xmlData->getElements("AdhesionMolecule"); vector<string> adhesionMoleculeNameVec; set<string> adhesionMoleculeNameSet; moleculeNameIndexMap.clear(); for (int i = 0 ; i<adhesionMoleculeNameXMLVec.size(); ++i){ string moleculeName=adhesionMoleculeNameXMLVec[i]->getAttribute("Molecule"); if (! adhesionMoleculeNameSet.insert(moleculeName).second){ ASSERT_OR_THROW(string("Duplicate molecule Name=")+moleculeName+ " specified in AdhesionMolecule section ", false); } adhesionMoleculeNameVec.push_back(moleculeName); moleculeNameIndexMap.insert(make_pair(moleculeName,i)); } numberOfAdhesionMolecules=moleculeNameIndexMap.size(); if (!sim->getRestartEnabled()){ adhesionMoleculeDensityVecMedium=vector<float>(numberOfAdhesionMolecules,0.0); } cerr<<"numberOfAdhesionMolecules="<<numberOfAdhesionMolecules<<endl; //scannning AdhesionMoleculeDensity section CC3DXMLElementList adhesionMoleculeDensityXMLVec=_xmlData->getElements("AdhesionMoleculeDensity"); typeToAdhesionMoleculeDensityMap.clear(); std::map<int,std::vector<float> >::iterator mitr; for (int i = 0 ; i<adhesionMoleculeDensityXMLVec.size(); ++i){ int typeId=automaton->getTypeId(adhesionMoleculeDensityXMLVec[i]->getAttribute("CellType")); cerr<<"typeId="<<typeId<<endl; mitr=typeToAdhesionMoleculeDensityMap.find(typeId); if (mitr==typeToAdhesionMoleculeDensityMap.end()){ typeToAdhesionMoleculeDensityMap.insert(make_pair(typeId,vector<float>(numberOfAdhesionMolecules,0.0))); cerr<<"typeToAdhesionMoleculeDensityMap[typeId].size()="<<typeToAdhesionMoleculeDensityMap[typeId].size()<<endl; } string moleculeName=adhesionMoleculeDensityXMLVec[i]->getAttribute("Molecule"); cerr<<"moleculeName="<<moleculeName<<endl; if(moleculeNameIndexMap.find(moleculeName)==moleculeNameIndexMap.end()){ ASSERT_OR_THROW(string("Molecule Name=")+moleculeName+" was not declared in the AdhesionMolecule section",false); } cerr<<"moleculeNameIndexMap[moleculeName]="<<moleculeNameIndexMap[moleculeName]<<endl; cerr<<"adhesionMoleculeDensityXMLVec[i]->getAttributeAsDouble(Density)="<<adhesionMoleculeDensityXMLVec[i]->getAttributeAsDouble("Density")<<endl; cerr<<"typeToAdhesionMoleculeDensityMap[typeId].size()="<<typeToAdhesionMoleculeDensityMap[typeId].size()<<endl; typeToAdhesionMoleculeDensityMap[typeId][moleculeNameIndexMap[moleculeName]]=adhesionMoleculeDensityXMLVec[i]->getAttributeAsDouble("Density"); cerr<<"AFTER ASSIGNING DENSITY"<<endl; } //scanning BindingFormula section CC3DXMLElement * bindingFormulaXMLElem=_xmlData->getFirstElement("BindingFormula"); formulaString=bindingFormulaXMLElem->getFirstElement("Formula")->getText(); //formula string CC3DXMLElement * variablesSectionXMLElem=bindingFormulaXMLElem->getFirstElement("Variables"); //cerr<<"formulaString="<<formulaString<<endl; //here we can add options depending on variables input - for now it is har-coded to accept only matrix of bindingParameters bindingParameters.clear() ; //have to clear binding parameters CC3DXMLElement * adhesionInteractionMatrixXMLElem = variablesSectionXMLElem->getFirstElement("AdhesionInteractionMatrix"); CC3DXMLElementList bindingParameterXMLVec = adhesionInteractionMatrixXMLElem->getElements("BindingParameter"); for (int i = 0 ; i<bindingParameterXMLVec.size(); ++i){ setBindingParameter(bindingParameterXMLVec[i]->getAttribute("Molecule1") , bindingParameterXMLVec[i]->getAttribute("Molecule2"), bindingParameterXMLVec[i]->getDouble()); } //vectorized variables for convenient parallel access unsigned int maxNumberOfWorkNodes=pUtils->getMaxNumberOfWorkNodesPotts(); molecule1Vec.assign(maxNumberOfWorkNodes,0.0); molecule2Vec.assign(maxNumberOfWorkNodes,0.0); pVec.assign(maxNumberOfWorkNodes,mu::Parser()); for (int i = 0 ; i< maxNumberOfWorkNodes ; ++i){ pVec[i].DefineVar("Molecule1",&molecule1Vec[i]); pVec[i].DefineVar("Molecule2",&molecule2Vec[i]); pVec[i].SetExpr(formulaString); } // p=mu::Parser(); //using new parser // //setting up muParser // p.DefineVar("Molecule1", &molecule1); // p.DefineVar("Molecule2", &molecule2); // p.SetExpr(formulaString); //scanning NeighborOrder or Depth //Here I initialize max neighbor index for direct acces to the list of neighbors boundaryStrategy=BoundaryStrategy::getInstance(); maxNeighborIndex=0; if(_xmlData->getFirstElement("Depth")){ maxNeighborIndex=boundaryStrategy->getMaxNeighborIndexFromDepth(_xmlData->getFirstElement("Depth")->getDouble()); //cerr<<"got here will do depth"<<endl; }else{ //cerr<<"got here will do neighbor order"<<endl; if(_xmlData->getFirstElement("NeighborOrder")){ maxNeighborIndex=boundaryStrategy->getMaxNeighborIndexFromNeighborOrder(_xmlData->getFirstElement("NeighborOrder")->getUInt()); cerr<<"maxNeighborIndex="<<maxNeighborIndex<<endl; }else{ maxNeighborIndex=boundaryStrategy->getMaxNeighborIndexFromNeighborOrder(1); } } cerr<<"sizeBindingArray="<<moleculeNameIndexMap.size()<<endl; //initializing binding parameter array int sizeBindingArray=moleculeNameIndexMap.size(); int indexBindingArray ; bindingParameterArray.clear(); bindingParameterArray.assign(sizeBindingArray,vector<double>(sizeBindingArray,0.0)); bindingParameters_t::iterator bmitr; for(int i = 0 ; i < sizeBindingArray ; ++i) for(int j = 0 ; j < sizeBindingArray ; ++j){ indexBindingArray= getIndex(i,j); bmitr=bindingParameters.find(indexBindingArray); if(bmitr!=bindingParameters.end()){ bindingParameterArray[i][j] = bmitr->second; } } for(int i = 0 ; i < sizeBindingArray ; ++i) for(int j = 0 ; j < sizeBindingArray ; ++j){ cerr<<"bindingParameterArray["<<i<<"]["<<j<<"]="<<bindingParameterArray[i][j]<<endl; } }
void FiPySolver::update(CC3DXMLElement *_xmlData, bool _fullInitFlag){ //notice, only basic steering is enabled for PDE solvers - changing diffusion constants, do -not-diffuse to types etc... // Coupling coefficients cannot be changed and also there is no way to allocate extra fields while simulation is running if(potts->getDisplayUnitsFlag()){ Unit diffConstUnit=powerUnit(potts->getLengthUnit(),2)/potts->getTimeUnit(); Unit decayConstUnit=1/potts->getTimeUnit(); Unit secretionConstUnit=1/potts->getTimeUnit(); CC3DXMLElement * unitsElem=_xmlData->getFirstElement("Units"); if (!unitsElem){ //add Units element unitsElem=_xmlData->attachElement("Units"); } if(unitsElem->getFirstElement("DiffusionConstantUnit")){ unitsElem->getFirstElement("DiffusionConstantUnit")->updateElementValue(diffConstUnit.toString()); }else{ unitsElem->attachElement("DiffusionConstantUnit",diffConstUnit.toString()); } if(unitsElem->getFirstElement("DecayConstantUnit")){ unitsElem->getFirstElement("DecayConstantUnit")->updateElementValue(decayConstUnit.toString()); }else{ unitsElem->attachElement("DecayConstantUnit",decayConstUnit.toString()); } if(unitsElem->getFirstElement("DeltaXUnit")){ unitsElem->getFirstElement("DeltaXUnit")->updateElementValue(potts->getLengthUnit().toString()); }else{ unitsElem->attachElement("DeltaXUnit",potts->getLengthUnit().toString()); } if(unitsElem->getFirstElement("DeltaTUnit")){ unitsElem->getFirstElement("DeltaTUnit")->updateElementValue(potts->getTimeUnit().toString()); }else{ unitsElem->attachElement("DeltaTUnit",potts->getTimeUnit().toString()); } if(unitsElem->getFirstElement("CouplingCoefficientUnit")){ unitsElem->getFirstElement("CouplingCoefficientUnit")->updateElementValue(decayConstUnit.toString()); }else{ unitsElem->attachElement("CouplingCoefficientUnit",decayConstUnit.toString()); } if(unitsElem->getFirstElement("SecretionUnit")){ unitsElem->getFirstElement("SecretionUnit")->updateElementValue(secretionConstUnit.toString()); }else{ unitsElem->attachElement("SecretionUnit",secretionConstUnit.toString()); } if(unitsElem->getFirstElement("SecretionOnContactUnit")){ unitsElem->getFirstElement("SecretionOnContactUnit")->updateElementValue(secretionConstUnit.toString()); }else{ unitsElem->attachElement("SecretionOnContactUnit",secretionConstUnit.toString()); } if(unitsElem->getFirstElement("ConstantConcentrationUnit")){ unitsElem->getFirstElement("ConstantConcentrationUnit")->updateElementValue(secretionConstUnit.toString()); }else{ unitsElem->attachElement("ConstantConcentrationUnit",secretionConstUnit.toString()); } if(unitsElem->getFirstElement("DecayConstantUnit")){ unitsElem->getFirstElement("DecayConstantUnit")->updateElementValue(decayConstUnit.toString()); }else{ unitsElem->attachElement("DecayConstantUnit",decayConstUnit.toString()); } if(unitsElem->getFirstElement("DeltaXUnit")){ unitsElem->getFirstElement("DeltaXUnit")->updateElementValue(potts->getLengthUnit().toString()); }else{ unitsElem->attachElement("DeltaXUnit",potts->getLengthUnit().toString()); } if(unitsElem->getFirstElement("DeltaTUnit")){ unitsElem->getFirstElement("DeltaTUnit")->updateElementValue(potts->getTimeUnit().toString()); }else{ unitsElem->attachElement("DeltaTUnit",potts->getTimeUnit().toString()); } if(unitsElem->getFirstElement("CouplingCoefficientUnit")){ unitsElem->getFirstElement("CouplingCoefficientUnit")->updateElementValue(decayConstUnit.toString()); }else{ unitsElem->attachElement("CouplingCoefficientUnit",decayConstUnit.toString()); } if(unitsElem->getFirstElement("UptakeUnit")){ unitsElem->getFirstElement("UptakeUnit")->updateElementValue(decayConstUnit.toString()); }else{ unitsElem->attachElement("UptakeUnit",decayConstUnit.toString()); } if(unitsElem->getFirstElement("RelativeUptakeUnit")){ unitsElem->getFirstElement("RelativeUptakeUnit")->updateElementValue(decayConstUnit.toString()); }else{ unitsElem->attachElement("RelativeUptakeUnit",decayConstUnit.toString()); } if(unitsElem->getFirstElement("MaxUptakeUnit")){ unitsElem->getFirstElement("MaxUptakeUnit")->updateElementValue(decayConstUnit.toString()); }else{ unitsElem->attachElement("MaxUptakeUnit",decayConstUnit.toString()); } } diffSecrFieldTuppleVec.clear(); bcSpecVec.clear(); bcSpecFlagVec.clear(); CC3DXMLElementList diffFieldXMLVec=_xmlData->getElements("DiffusionField"); for(unsigned int i = 0 ; i < diffFieldXMLVec.size() ; ++i ){ diffSecrFieldTuppleVec.push_back(DiffusionSecretionFiPyFieldTupple()); DiffusionData & diffData=diffSecrFieldTuppleVec[diffSecrFieldTuppleVec.size()-1].diffData; SecretionData & secrData=diffSecrFieldTuppleVec[diffSecrFieldTuppleVec.size()-1].secrData; if(diffFieldXMLVec[i]->findElement("DiffusionData")) diffData.update(diffFieldXMLVec[i]->getFirstElement("DiffusionData")); if(diffFieldXMLVec[i]->findElement("SecretionData")) secrData.update(diffFieldXMLVec[i]->getFirstElement("SecretionData")); if(diffFieldXMLVec[i]->findElement("ReadFromFile")) readFromFileFlag=true; //boundary conditions parsing bcSpecFlagVec.push_back(false); bcSpecVec.push_back(BoundaryConditionSpecifier()); if (diffFieldXMLVec[i]->findElement("BoundaryConditions")){ bcSpecFlagVec[bcSpecFlagVec.size()-1]=true; BoundaryConditionSpecifier & bcSpec = bcSpecVec[bcSpecVec.size()-1]; CC3DXMLElement * bcSpecElem = diffFieldXMLVec[i]->getFirstElement("BoundaryConditions"); CC3DXMLElementList planeVec = bcSpecElem->getElements("Plane"); for(unsigned int ip = 0 ; ip < planeVec.size() ; ++ip ){ ASSERT_OR_THROW ("Boundary Condition specification Plane element is missing Axis attribute",planeVec[ip]->findAttribute("Axis")); string axisName=planeVec[ip]->getAttribute("Axis"); int index=0; if (axisName=="x" ||axisName=="X" ){ index=0; } if (axisName=="y" ||axisName=="Y" ){ index=2; } if (axisName=="z" ||axisName=="Z" ){ index=4; } if (planeVec[ip]->findElement("Periodic")){ bcSpec.planePositions[index]=BoundaryConditionSpecifier::PERIODIC; bcSpec.planePositions[index+1]=BoundaryConditionSpecifier::PERIODIC; }else { //if (planeVec[ip]->findElement("ConstantValue")){ CC3DXMLElementList cvVec=planeVec[ip]->getElements("ConstantValue"); CC3DXMLElementList cdVec=planeVec[ip]->getElements("ConstantDerivative"); for (unsigned int v = 0 ; v < cvVec.size() ; ++v ){ string planePos=cvVec[v]->getAttribute("PlanePosition"); double value=cvVec[v]->getAttributeAsDouble("Value"); changeToLower(planePos); if (planePos=="min"){ bcSpec.planePositions[index]=BoundaryConditionSpecifier::CONSTANT_VALUE; bcSpec.values[index]=value; }else if (planePos=="max"){ bcSpec.planePositions[index+1]=BoundaryConditionSpecifier::CONSTANT_VALUE; bcSpec.values[index+1]=value; }else{ ASSERT_OR_THROW("PlanePosition attribute has to be either max on min",false); } } if (cvVec.size()<=1){ for (unsigned int d = 0 ; d < cdVec.size() ; ++d ){ string planePos=cdVec[d]->getAttribute("PlanePosition"); double value=cdVec[d]->getAttributeAsDouble("Value"); changeToLower(planePos); if (planePos=="min"){ bcSpec.planePositions[index]=BoundaryConditionSpecifier::CONSTANT_DERIVATIVE; bcSpec.values[index]=value; }else if (planePos=="max"){ bcSpec.planePositions[index+1]=BoundaryConditionSpecifier::CONSTANT_DERIVATIVE; bcSpec.values[index+1]=value; }else{ ASSERT_OR_THROW("PlanePosition attribute has to be either max on min",false); } } } } } } } if(_xmlData->findElement("Serialize")){ serializeFlag=true; if(_xmlData->getFirstElement("Serialize")->findAttribute("Frequency")){ serializeFrequency=_xmlData->getFirstElement("Serialize")->getAttributeAsUInt("Frequency"); } cerr<<"serialize Flag="<<serializeFlag<<endl; } if(_xmlData->findElement("ReadFromFile")){ readFromFileFlag=true; cerr<<"readFromFileFlag="<<readFromFileFlag<<endl; } for(int i = 0 ; i < diffSecrFieldTuppleVec.size() ; ++i){ diffSecrFieldTuppleVec[i].diffData.setAutomaton(automaton); diffSecrFieldTuppleVec[i].secrData.setAutomaton(automaton); diffSecrFieldTuppleVec[i].diffData.initialize(automaton); diffSecrFieldTuppleVec[i].secrData.initialize(automaton); } ///assigning member method ptrs to the vector for(unsigned int i = 0 ; i < diffSecrFieldTuppleVec.size() ; ++i){ diffSecrFieldTuppleVec[i].secrData.secretionFcnPtrVec.assign(diffSecrFieldTuppleVec[i].secrData.secrTypesNameSet.size(),0); unsigned int j=0; for(set<string>::iterator sitr=diffSecrFieldTuppleVec[i].secrData.secrTypesNameSet.begin() ; sitr != diffSecrFieldTuppleVec[i].secrData.secrTypesNameSet.end() ; ++sitr){ if((*sitr)=="Secretion"){ diffSecrFieldTuppleVec[i].secrData.secretionFcnPtrVec[j]=&FiPySolver::secreteSingleField; ++j; } else if((*sitr)=="SecretionOnContact"){ diffSecrFieldTuppleVec[i].secrData.secretionFcnPtrVec[j]=&FiPySolver::secreteOnContactSingleField; ++j; } else if((*sitr)=="ConstantConcentration"){ diffSecrFieldTuppleVec[i].secrData.secretionFcnPtrVec[j]=&FiPySolver::secreteConstantConcentrationSingleField; ++j; } } } }
void PlayerSettingsPlugin::update(CC3DXMLElement *_xmlData, bool _fullInitFlag){ cerr<<"_xmlData="<<_xmlData<<endl; CC3DXMLElement *proj2DElement; proj2DElement=_xmlData->getFirstElement("Project2D"); if(proj2DElement){ ///reading 2D settings - projections if(proj2DElement->findAttribute("XYProj")){ playerSettings.xyProj=proj2DElement->getAttributeAsUInt("XYProj"); playerSettings.xyProjFlag=true; } if(proj2DElement->findAttribute("XZProj")){ playerSettings.xzProj=proj2DElement->getAttributeAsUInt("XZProj"); playerSettings.xzProjFlag=true; } if(proj2DElement->findAttribute("YZProj")){ playerSettings.yzProj=proj2DElement->getAttributeAsUInt("YZProj"); playerSettings.yzProjFlag=true; } } CC3DXMLElement *rot3DElement; rot3DElement=_xmlData->getFirstElement("Rotate3D"); if(rot3DElement){ ///reading 3D settings - rotations if(rot3DElement->findAttribute("XRot")){ playerSettings.rotationX=rot3DElement->getAttributeAsUInt("XRot"); playerSettings.rotationXFlag=true; } if(rot3DElement->findAttribute("YRot")){ playerSettings.rotationY=rot3DElement->getAttributeAsUInt("YRot"); playerSettings.rotationYFlag=true; } if(rot3DElement->findAttribute("ZRot")){ playerSettings.rotationZ=rot3DElement->getAttributeAsUInt("ZRot"); playerSettings.rotationZFlag=true; } } CC3DXMLElement *resize3DElement; resize3DElement=_xmlData->getFirstElement("Resize3D"); if(resize3DElement){ ///reading 3D widget size parameters used by player - the bigger the smaller object will be if(resize3DElement->findAttribute("X")){ playerSettings.sizeX3D=resize3DElement->getAttributeAsUInt("X"); playerSettings.sizeX3DFlag=true; } if(resize3DElement->findAttribute("Y")){ playerSettings.sizeY3D=resize3DElement->getAttributeAsUInt("Y"); playerSettings.sizeY3DFlag=true; } if(resize3DElement->findAttribute("Z")){ playerSettings.sizeZ3D=resize3DElement->getAttributeAsUInt("Z"); playerSettings.sizeZ3DFlag=true; } } CC3DXMLElement *view3DElement=_xmlData->getFirstElement("View3D"); if (view3DElement){ CC3DXMLElement *clippingRangeElement=view3DElement->getFirstElement("ClippingRange"); if (clippingRangeElement){ playerSettings.clippingRange[0]=clippingRangeElement->getAttributeAsDouble("Min"); playerSettings.clippingRange[1]=clippingRangeElement->getAttributeAsDouble("Max"); } CC3DXMLElement *focalPointElement=view3DElement->getFirstElement("focalPoint"); if (focalPointElement){ playerSettings.focalPoint[0]=focalPointElement->getAttributeAsDouble("x"); playerSettings.focalPoint[1]=focalPointElement->getAttributeAsDouble("y"); playerSettings.focalPoint[1]=focalPointElement->getAttributeAsDouble("z"); } CC3DXMLElement *positionElement=view3DElement->getFirstElement("position"); if (positionElement){ playerSettings.position[0]=positionElement->getAttributeAsDouble("x"); playerSettings.position[1]=positionElement->getAttributeAsDouble("y"); playerSettings.position[1]=positionElement->getAttributeAsDouble("z"); } CC3DXMLElement *viewUpElement=view3DElement->getFirstElement("viewUp"); if (viewUpElement){ playerSettings.viewUp[0]=viewUpElement->getAttributeAsDouble("x"); playerSettings.viewUp[1]=viewUpElement->getAttributeAsDouble("y"); playerSettings.viewUp[1]=viewUpElement->getAttributeAsDouble("z"); } } CC3DXMLElement *initProjXMLElement=_xmlData->getFirstElement("InitialProjection"); if(initProjXMLElement){ if(initProjXMLElement->findAttribute("Projection")){ playerSettings.initialProjection=initProjXMLElement->getAttribute("Projection"); //changing to lowercase changeToLower(playerSettings.initialProjection); ASSERT_OR_THROW("InitialProjection has have a value of xy or xz or yz", playerSettings.initialProjection=="xy" || playerSettings.initialProjection=="xz" || playerSettings.initialProjection=="yz" ); } } CC3DXMLElement *concXMLElement; concXMLElement=_xmlData->getFirstElement("Concentration"); if(concXMLElement){ ///reading 3D widget size parameters used by player - the bigger the smaller object will be playerSettings.advancedSettingsOn=true; if(concXMLElement->findAttribute("Min")){ playerSettings.minConcentration=concXMLElement->getAttributeAsDouble("Min"); playerSettings.minConcentrationFlag=true; playerSettings.minConcentrationFixed=true; playerSettings.minConcentrationFixedFlag=true; } if(concXMLElement->findAttribute("Max")){ playerSettings.maxConcentration=concXMLElement->getAttributeAsDouble("Max"); playerSettings.maxConcentrationFlag=true; playerSettings.maxConcentrationFixed=true; playerSettings.maxConcentrationFixedFlag=true; } if(concXMLElement->findAttribute("MinFixed")){ playerSettings.minConcentrationFixed=concXMLElement->getAttributeAsBool("MinFixed"); playerSettings.minConcentrationFixedFlag=true; } if(concXMLElement->findAttribute("MaxFixed")){ playerSettings.maxConcentrationFixed=concXMLElement->getAttributeAsBool("MaxFixed"); playerSettings.maxConcentrationFixedFlag=true; } if(concXMLElement->findAttribute("LegendEnable")){ playerSettings.legendEnable=concXMLElement->getAttributeAsBool("LegendEnable"); playerSettings.legendEnableFlag=true; } if(concXMLElement->findAttribute("NumberOfLegendBoxes")){ playerSettings.numberOfLegendBoxes=concXMLElement->getAttributeAsUInt("NumberOfLegendBoxes"); playerSettings.numberOfLegendBoxesFlag=true; } if(concXMLElement->findAttribute("NumberAccuracy")){ playerSettings.numberAccuracy=concXMLElement->getAttributeAsUInt("NumberAccuracy"); playerSettings.numberAccuracyFlag=true; } if(concXMLElement->findAttribute("ConcentrationLimitsOn")){ playerSettings.concentrationLimitsOn=concXMLElement->getAttributeAsBool("ConcentrationLimitsOn"); playerSettings.concentrationLimitsOnFlag=true; } } CC3DXMLElement *magnitudeXMLElement; magnitudeXMLElement=_xmlData->getFirstElement("Magnitude"); if(magnitudeXMLElement){ ///reading 3D widget size parameters used by player - the bigger the smaller object will be playerSettings.advancedSettingsOn=true; if(magnitudeXMLElement->findAttribute("Min")){ playerSettings.minMagnitude=magnitudeXMLElement->getAttributeAsDouble("Min"); playerSettings.minMagnitudeFlag=true; playerSettings.minMagnitudeFixed=true; playerSettings.minMagnitudeFixedFlag=true; } if(magnitudeXMLElement->findAttribute("Max")){ playerSettings.maxMagnitude=magnitudeXMLElement->getAttributeAsDouble("Max"); playerSettings.maxMagnitudeFlag=true; playerSettings.maxMagnitudeFixed=true; playerSettings.maxMagnitudeFixedFlag=true; } if(magnitudeXMLElement->findAttribute("MinFixed")){ playerSettings.minMagnitudeFixed=magnitudeXMLElement->getAttributeAsBool("MinFixed"); playerSettings.minMagnitudeFixedFlag=true; } if(magnitudeXMLElement->findAttribute("MaxFixed")){ playerSettings.maxMagnitudeFixed=magnitudeXMLElement->getAttributeAsBool("MaxFixed"); playerSettings.maxMagnitudeFixedFlag=true; } if(magnitudeXMLElement->findAttribute("LegendEnable")){ playerSettings.legendEnableVector=magnitudeXMLElement->getAttributeAsBool("LegendEnable"); playerSettings.legendEnableVectorFlag=true; } if(magnitudeXMLElement->findAttribute("NumberOfLegendBoxes")){ playerSettings.numberOfLegendBoxesVector=magnitudeXMLElement->getAttributeAsUInt("NumberOfLegendBoxes"); playerSettings.numberOfLegendBoxesVectorFlag=true; } if(magnitudeXMLElement->findAttribute("NumberAccuracy")){ playerSettings.numberAccuracyVector=magnitudeXMLElement->getAttributeAsUInt("NumberAccuracy"); playerSettings.numberAccuracyVectorFlag=true; } if(magnitudeXMLElement->findAttribute("OverlayVectorAndCellFields")){ playerSettings.overlayVectorCellFields=magnitudeXMLElement->getAttributeAsBool("OverlayVectorAndCellFields"); playerSettings.overlayVectorCellFieldsFlag=true; } if(magnitudeXMLElement->findAttribute("ScaleArrows")){ playerSettings.scaleArrows=magnitudeXMLElement->getAttributeAsBool("ScaleArrows"); playerSettings.scaleArrowsFlag=true; } if(magnitudeXMLElement->findAttribute("FixedArrowColorFlag")){ playerSettings.fixedArrowColorFlag=magnitudeXMLElement->getAttributeAsBool("FixedArrowColorFlag"); playerSettings.fixedArrowColorFlagFlag=true; } if(magnitudeXMLElement->findAttribute("ArrowColor")){ playerSettings.arrowColorName=magnitudeXMLElement->getAttribute("ArrowColor"); changeToLower(playerSettings.arrowColorName); playerSettings.arrowColorNameFlag=true; } } CC3DXMLElement *borderXMLElement=_xmlData->getFirstElement("Border"); if(borderXMLElement){ playerSettings.advancedSettingsOn=true; if(borderXMLElement->findAttribute("Color")){ playerSettings.borderColorName=borderXMLElement->getAttribute("Color"); //changing to lowercase changeToLower(playerSettings.borderColorName); playerSettings.borderColorNameFlag=true; } if(borderXMLElement->findAttribute("BorderOn")){ playerSettings.borderOn=borderXMLElement->getAttributeAsBool("BorderOn"); playerSettings.borderOnFlag=true; } } CC3DXMLElement *contourXMLElement=_xmlData->getFirstElement("Contour"); if(contourXMLElement){ playerSettings.advancedSettingsOn=true; if(contourXMLElement->findAttribute("Color")){ playerSettings.contourColorName=contourXMLElement->getAttribute("Color"); //changing to lowercase changeToLower(playerSettings.contourColorName); playerSettings.contourColorNameFlag=true; } if(contourXMLElement->findAttribute("ContourOn")){ playerSettings.contourOn=contourXMLElement->getAttributeAsBool("ContourOn"); playerSettings.contourOnFlag=true; } } CC3DXMLElementList cellColorVecXML=_xmlData->getElements("Cell"); for(int i = 0 ; i < cellColorVecXML.size() ; ++i ){ playerSettings.advancedSettingsOn=true; std::string color; unsigned short type; type=(unsigned short)cellColorVecXML[i]->getAttributeAsUInt("Type"); color=cellColorVecXML[i]->getAttributeAsUInt("Color"); playerSettings.typeToColorNameMap[type]=color; playerSettings.typeToColorNameMapFlag=true; } CC3DXMLElement *visContrXMLElement=_xmlData->getFirstElement("VisualControl"); if(visContrXMLElement){ playerSettings.advancedSettingsOn=true; if(visContrXMLElement->findAttribute("ZoomFactor")){ playerSettings.zoomFactor=visContrXMLElement->getAttributeAsUInt("ZoomFactor"); playerSettings.zoomFactorFlag=true; } if(visContrXMLElement->findAttribute("ScreenshotFrequency")){ playerSettings.screenshotFrequency=visContrXMLElement->getAttributeAsUInt("ScreenshotFrequency"); playerSettings.screenshotFrequencyFlag=true; } if(visContrXMLElement->findAttribute("ScreenUpdateFrequency")){ playerSettings.screenUpdateFrequency=visContrXMLElement->getAttributeAsUInt("ScreenUpdateFrequency"); playerSettings.screenUpdateFrequencyFlag=true; } if(visContrXMLElement->findAttribute("NoOutput")){ playerSettings.noOutputFlag=visContrXMLElement->getAttributeAsBool("NoOutput"); playerSettings.noOutputFlagFlag=true; } } CC3DXMLElement *types3DInvisElement=_xmlData->getFirstElement("TypesInvisibleIn3D"); if(types3DInvisElement){ playerSettings.advancedSettingsOn=true; std::string typesInvisibleIn3DString=types3DInvisElement->getAttribute("Types"); vector<string> typesInvisiblein3DVector; parseStringIntoList(typesInvisibleIn3DString,typesInvisiblein3DVector,","); for(unsigned int i = 0 ; i < typesInvisiblein3DVector.size() ; ++i){ playerSettings.types3DInvisible.push_back((unsigned short)BasicString::parseUInteger(typesInvisiblein3DVector[i])); } playerSettings.types3DInvisibleFlag=true; } CC3DXMLElement *settingsXMLElement=_xmlData->getFirstElement("Settings"); if(settingsXMLElement){ if(settingsXMLElement->findAttribute("SaveSettings")){ playerSettings.saveSettings=settingsXMLElement->getAttributeAsBool("SaveSettings"); playerSettings.saveSettingsFlag=true; } } }