Changeset 1006 for cpp/frams/genetics/fS/fS_general.cpp
- Timestamp:
- 07/14/20 16:04:46 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/fS/fS_general.cpp
r1000 r1006 17 17 bool fS_Genotype::TURN_WITH_ROTATION = false; 18 18 19 const std::map<string, double> defaultValues = { 20 {INGESTION, 0.5},//Model::getDefPart().ingest }, 21 {FRICTION, 0.5},//Model::getDefPart().friction}, 22 {STIFFNESS, 0.5},//Model::getDefJoint().stif}, 23 {ROT_X, 0.0}, 24 {ROT_Y, 0.0}, 25 {ROT_Z, 0.0}, 26 {RX, 0.0}, 27 {RY, 0.0}, 28 {RZ, 0.0}, 29 {SIZE, 1.0}, 30 {SIZE_X, 0.5},//Model::getDefPart().scale.x}, 31 {SIZE_Y, 0.5},//Model::getDefPart().scale.y}, 32 {SIZE_Z, 0.5}//Model::getDefPart().scale.z} 33 }; 19 void Node::prepareParams() 20 { 21 defaultValues = { 22 {INGESTION, Model::getDefPart().ingest}, 23 {FRICTION, Model::getDefPart().friction}, 24 {STIFFNESS, Model::getDefJoint().stif}, 25 {ROT_X, 0.0}, 26 {ROT_Y, 0.0}, 27 {ROT_Z, 0.0}, 28 {RX, 0.0}, 29 {RY, 0.0}, 30 {RZ, 0.0}, 31 {SIZE, 1.0}, 32 {SIZE_X, Model::getDefPart().scale.x}, 33 {SIZE_Y, Model::getDefPart().scale.y}, 34 {SIZE_Z, Model::getDefPart().scale.z} 35 }; 36 } 34 37 35 38 double fS_stod(const string& str, int start, size_t* size) … … 76 79 77 80 78 fS_Neuron::fS_Neuron(const char *str, int start, int length) 79 { 81 fS_Neuron::fS_Neuron(const char *str, int _start, int length) 82 { 83 start = _start + 1; 84 end = start + length; 80 85 if (length == 0) 81 86 return; … … 123 128 Node::Node(Substring &restOfGeno, Node *_parent, GenotypeParams _genotypeParams) 124 129 { 130 prepareParams(); 125 131 partDescription = new Substring(restOfGeno); 126 132 genotypeParams = _genotypeParams; … … 165 171 for (int i = 0; i < restOfGenotype.len; i++) 166 172 { 167 if (GENE_TO_SHAPE TYPE.find(restOfGenotype.at(i)) != GENE_TO_SHAPETYPE.end())173 if (GENE_TO_SHAPE.find(restOfGenotype.at(i)) != GENE_TO_SHAPE.end()) 168 174 return i; 169 175 } … … 193 199 void Node::extractPartType(Substring &restOfGenotype) 194 200 { 195 auto itr = GENE_TO_SHAPE TYPE.find(restOfGenotype.at(0));196 if (itr == GENE_TO_SHAPE TYPE.end())201 auto itr = GENE_TO_SHAPE.find(restOfGenotype.at(0)); 202 if (itr == GENE_TO_SHAPE.end()) 197 203 throw fS_Exception("Invalid part type", restOfGenotype.start); 198 204 … … 465 471 Neuro *neuro = new Neuro(*neurons[i]); 466 472 model.addNeuro(neuro); 473 neuro->addMapping(MultiRange(IRange(neurons[i]->start, neurons[i]->end))); 467 474 if (neuro->getClass()->preflocation == NeuroClass::PREFER_JOINT && parent != nullptr) 468 475 { … … 536 543 result += std::string(count, mod).c_str(); 537 544 } 538 result += SHAPE TYPE_TO_GENE.at(partType);545 result += SHAPE_TO_GENE.at(partType); 539 546 540 547 if (!neurons.empty()) … … 649 656 } 650 657 651 void fS_Genotype::buildModel(Model &model) 652 { 658 Model fS_Genotype::buildModel(bool using_checkpoints) 659 { 660 661 Model model; 662 model.open(using_checkpoints); 663 653 664 getState(); 654 665 startNode->buildModel(model, nullptr); 655 666 buildNeuroConnections(model); 667 668 model.close(); 669 return model; 656 670 } 657 671
Note: See TracChangeset
for help on using the changeset viewer.