Changeset 10428
- Timestamp:
- 11/02/11 10:54:29 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Penta.cpp
r10419 r10428 1419 1419 void Penta::InputExtrude(int enum_type,int object_type){ 1420 1420 1421 Penta *penta = NULL; 1422 Input *original_input = NULL; 1421 int i,num_inputs; 1422 Penta *penta = NULL; 1423 Input **base_inputs = NULL; 1424 Input *copy = NULL; 1423 1425 1424 1426 /*Are we on the base, not on the surface?:*/ 1425 if(IsOnBed()){ 1426 /*OK, we are on bed. we will follow the steps: 1427 * 1: find input and extrude it. 1428 * 2: follow the upper element until we reach the surface 1429 * 3: for each element, we will add a copy of the extruded input*/ 1430 1431 /*Step1: Extrude the original input: */ 1432 if (object_type==MeshElementsEnum) 1433 original_input=(Input*)this->inputs->GetInput(enum_type); 1434 else if (object_type==MaterialsEnum) 1435 original_input=(Input*)matice->inputs->GetInput(enum_type); 1436 else 1437 _error_("object of type %s not supported yet",EnumToStringx(object_type)); 1438 if(!original_input) _error_("%s%s"," could not find input with enum:",EnumToStringx(enum_type)); 1439 original_input->Extrude(); 1440 1441 /*Stop if there is only one layer of element*/ 1442 if (this->IsOnSurface()) return; 1443 1444 /*Step 2: this input has been extruded for this element, now follow the upper element*/ 1445 penta=this; 1446 for(;;){ 1447 1448 /* get upper Penta*/ 1449 penta=penta->GetUpperElement(); 1450 _assert_(penta->Id()!=this->id); 1451 1452 /*Add input of the basal element to penta->inputs*/ 1453 Input* copy=NULL; 1454 copy=(Input*)original_input->copy(); 1455 if (object_type==MeshElementsEnum) 1456 penta->inputs->AddInput((Input*)copy); 1457 else if (object_type==MaterialsEnum) 1458 penta->matice->inputs->AddInput((Input*)copy); 1459 else 1460 _error_("object of type %s not supported yet",EnumToStringx(object_type)); 1461 1462 /*Stop if we have reached the surface*/ 1463 if (penta->IsOnSurface()) break; 1464 } 1465 } 1466 1467 return; 1427 if(!IsOnBed()) return; 1428 1429 /*Step1: Get and Extrude original input: */ 1430 if (object_type==ElementEnum){ 1431 num_inputs=1; 1432 base_inputs=(Input**)xmalloc(num_inputs*sizeof(Input*)); 1433 base_inputs[0]=(Input*)this->inputs->GetInput(enum_type); 1434 } 1435 else if (object_type==MaterialsEnum){ 1436 num_inputs=1; 1437 base_inputs=(Input**)xmalloc(num_inputs*sizeof(Input*)); 1438 base_inputs[0]=(Input*)this->inputs->GetInput(enum_type); 1439 } 1440 else if (object_type==NodeEnum){ 1441 num_inputs=6; 1442 base_inputs=(Input**)xmalloc(num_inputs*sizeof(Input*)); 1443 for(i=0;i<num_inputs;i++){ 1444 base_inputs[i]=(Input*)this->nodes[i]->inputs->GetInput(enum_type); 1445 } 1446 } 1447 else{ 1448 _error_("object of type %s not supported yet",EnumToStringx(object_type)); 1449 } 1450 for(i=0;i<num_inputs;i++){ 1451 if(!base_inputs[i]) _error_("could not find input with enum %s in object %s",EnumToStringx(enum_type),EnumToStringx(object_type)); 1452 base_inputs[i]->Extrude(); 1453 } 1454 1455 /*Stop if there is only one layer of element*/ 1456 if (this->IsOnSurface()) return; 1457 1458 /*Step 2: this input has been extruded for this element, now follow the upper element*/ 1459 penta=this; 1460 for(;;){ 1461 1462 /* get upper Penta*/ 1463 penta=penta->GetUpperElement(); 1464 _assert_(penta->Id()!=this->id); 1465 1466 /*Add input of the basal element to penta->inputs*/ 1467 for(i=0;i<num_inputs;i++){ 1468 copy=(Input*)base_inputs[i]->copy(); 1469 if (object_type==ElementEnum){ 1470 penta->inputs->AddInput((Input*)copy); 1471 } 1472 else if (object_type==MaterialsEnum){ 1473 penta->matice->inputs->AddInput((Input*)copy); 1474 } 1475 else if (object_type==NodeEnum){ 1476 penta->nodes[i]->inputs->AddInput((Input*)copy); 1477 } 1478 else{ 1479 _error_("object of type %s not supported yet",EnumToStringx(object_type)); 1480 } 1481 } 1482 1483 /*Stop if we have reached the surface*/ 1484 if (penta->IsOnSurface()) break; 1485 } 1486 1487 /*clean-up and return*/ 1488 xfree((void**)&base_inputs); 1468 1489 } 1469 1490 /*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.