public static function add($objects)
 {
     //Prepare arrays
     self::$commonMemberLoadArray = array();
     self::$notFoundObjects = array();
     //Get TABLES
     self::$hashTable = \Classes\Factory\Model\Model::getHashTable();
     self::$loadTable = \Classes\Factory\Model\Model::getLoadTable();
     self::$commonMemberLoadTable = new \Classes\Factory\Model\Table\LoadTable();
     self::$emptyConnection = new \Classes\Factory\Connection\LoadConnection\GlobalCoordinateSystem();
     // Distribute objects to arrays
     foreach ($objects as $object) {
         self::prepareObject($object);
     }
     // DELETE DOUBLE NODES
     $tableArray = array(self::$hashTable, self::$commonMemberLoadTable);
     \Classes\Utils\Node\DoubleNodes::combineAll($tableArray);
     // SORT NODES
     \Classes\Factory\Model\Model::sortNodes();
     // Get NODES, MEMBERS
     self::$nodes = \Classes\Factory\Model\Model::getNodes();
     self::$members = \Classes\Factory\Model\Model::getMembers();
     // Find destination for all Common Member Loads
     self::distribute();
     // Return all not found loads
     $notFoundObjects = array();
     foreach (self::$notFoundObjects as $uin) {
         $notFoundObjects[] = self::$commonMemberLoadArray[$uin];
     }
     return $notFoundObjects;
 }
Пример #2
0
 static function numerateFromOne()
 {
     $members = \Classes\Factory\Model\Model::getMembers();
     $id = 1;
     foreach ($members as $member) {
         $member->setProperty('id', new \Classes\Value\IntValue($id));
         $id++;
     }
 }
 public static function export($path)
 {
     self::$members = \Classes\Factory\Model\Model::getMembers();
     self::$steelMemberCheckGroups = \Classes\Factory\Model\Model::getSteelMemberCheckGroups();
     // START
     self::$array = array();
     //EXPORT
     self::steelMemberCheckGroupsExport();
     file_put_contents($path, json_encode(self::$array));
 }
 protected function add($uin, $object)
 {
     // Load information array
     $loadInfoArray = array();
     // Get information about Instance where Load is connected
     $connectionArray = \Classes\Factory\Model\Model::getLoadTable()->getConnection($uin);
     // COORDINATE SYSTEM
     $coordinateSystem = reset($connectionArray)->get();
     // TARGET UIN
     $instanceTargetUin = key($connectionArray);
     // NODE LOAD
     if ($object instanceof \Classes\Instance\Load\Node\NodeLoad) {
         $id = \Classes\Factory\Model\Model::getNodes()[$instanceTargetUin]->getProperty('id')->get();
         $loadType = 0;
         $loadInfoArray[] = $object->getProperty('value')->get();
     }
     // CONCENTRATED MEMBER LOAD
     if ($object instanceof \Classes\Instance\Load\Member\ConcenratedMemberLoad) {
         $id = \Classes\Factory\Model\Model::getMembers()[$instanceTargetUin]->getProperty('id')->get();
         $loadType = 1;
         $loadInfoArray[] = $object->getProperty('value')->get();
         $loadInfoArray[] = $object->getProperty('position')->get();
     }
     // DISTRIBUTED MEMBER LOAD
     if ($object instanceof \Classes\Instance\Load\Member\DistributedMemberLoad) {
         $id = \Classes\Factory\Model\Model::getMembers()[$instanceTargetUin]->getProperty('id')->get();
         $loadType = 2;
         $loadInfoArray[] = $object->getProperty('value1')->get();
         $loadInfoArray[] = $object->getProperty('position1')->get();
         $loadInfoArray[] = $object->getProperty('value2')->get();
         $loadInfoArray[] = $object->getProperty('position2')->get();
     }
     $data = '';
     // LOAD CASE
     $data .= pack('S', $object->getProperty('loadCase')->get());
     // ID
     $data .= pack('I', $id);
     // LOAD TYPE
     $data .= pack('S', $loadType);
     // COORDINATE SYSTEM
     $data .= pack('S', $coordinateSystem);
     // DIRECTION
     $data .= pack('S', $object->getProperty('direction')->get());
     // LOAD INFORMATION
     $data .= pack('S', count($loadInfoArray));
     foreach ($loadInfoArray as $value) {
         $data .= pack('d', $value);
     }
     return $data;
 }
Пример #5
0
 public static function divideMemberByNode($memberUin, $nodeUin)
 {
     // Get nodes and members
     $nodes = \Classes\Factory\Model\Model::getNodes();
     $members = \Classes\Factory\Model\Model::getMembers();
     $hashTable = \Classes\Factory\Model\Model::getHashTable();
     // TODO isDivided
     //Check are node and member exist or not
     if (!isset($nodes[$nodeUin]) || !isset($members[$memberUin])) {
         return FALSE;
     }
     // Check if member is divided
     if ($members[$memberUin]->getProperty('isDivided')->get() == FALSE) {
         return FALSE;
     }
     // Get 2nd connection from oldMember
     $hash = $hashTable->getConnection($memberUin);
     $uin2 = array_keys($hash)[1];
     $con2 = array_values($hash)[1];
     // Create zero Pin connection
     $zeroPin = new \Classes\Factory\Connection\SixFreedomConnection\PinConnection();
     // Remove 2nd connection from oldMember
     $hashTable->removeConnection($memberUin, $uin2);
     // Set 2nd connection to oldMember
     $hashTable->setConnection($memberUin, $nodeUin, $zeroPin);
     // Create newMember same as oldMember
     $newMember = clone $members[$memberUin];
     //        echo "<br/>";
     //        echo "DIVIDE MEMBER $memberUin<br/>";
     //        echo "BY NODE $nodeUin<br/>";
     //        echo "NEW MEMBER " . $newMember->getUin() . "<br/>";
     //        echo "<br/>";
     //Add member to Model
     \Classes\Factory\Model\Model::addInstance($newMember);
     // Set 1st connection to newMember
     $hashTable->setConnection($newMember->getUin(), $nodeUin, $zeroPin);
     // Set 2nd connection to newMember
     $hashTable->setConnection($newMember->getUin(), $uin2, $con2);
     // Add information about operation in ListBoxCollection
     $actionCollection = \Classes\Factory\Model\Model::getMemberActionCollection();
     $actionCollection->addAction(new \Classes\Listbox\Action\ReplaceListboxAction($memberUin, array($memberUin, $newMember->getUin())));
     return $newMember->getUin();
 }
 public function servicePrint()
 {
     // Get members
     $members = \Classes\Factory\Model\Model::getMembers();
     $uin = $this->getUin();
     $name = $this->getProperty('name')->get();
     $steel = $this->getProperty('steel')->get();
     $Ry = $this->getProperty('Ry')->get();
     $gammaC = $this->getProperty('gammaC')->get();
     $muXZ = $this->getProperty('muXZ')->get();
     $muXY = $this->getProperty('muXY')->get();
     $FC = $this->getProperty('FC')->get();
     $list = $this->getProperty('listbox')->get();
     echo $uin . " => *{$name}* {$steel}({$Ry}) |{$gammaC}| {$muXZ}, {$muXY} - {$FC}<br/>";
     foreach ($list as $memberUin) {
         $memberId = $members[$memberUin]->getProperty('id')->get();
         echo " * {$memberUin} - {$memberId} <br/>";
     }
 }
 public static function export($path)
 {
     //        self::$restraints = \Classes\Factory\Model\Model::getRestraintTable()->getTable();
     //        self::$loadCases = \Classes\Factory\Model\Model::getLoadCases();
     //        self::$loads = \Classes\Factory\Model\Model::getLoads();
     //        self::$massMatrixTable = \Classes\Factory\Model\Model::getMassMatrixTable();
     //        self::$loadTable = \Classes\Factory\Model\Model::getLoadTable();
     //
     // GET FILE WRITER
     $fileWriter = BinaryData\File\FileWriterFactory::make();
     // EXPORT
     $fileWriter->export(\Classes\Factory\Model\Model::getNodes());
     $fileWriter->export(\Classes\Factory\Model\Model::getMembers());
     $fileWriter->export(\Classes\Factory\Model\Model::getRestraintTable()->getTable());
     $fileWriter->export(\Classes\Factory\Model\Model::getLoadCases());
     $fileWriter->export(\Classes\Factory\Model\Model::getLoads());
     // WRITE
     file_put_contents($path, $fileWriter->getBody());
 }
 public static function export($path)
 {
     self::$nodes = \Classes\Factory\Model\Model::getNodes();
     self::$members = \Classes\Factory\Model\Model::getMembers();
     self::$restraints = \Classes\Factory\Model\Model::getRestraintTable()->getTable();
     self::$loadCases = \Classes\Factory\Model\Model::getLoadCases();
     self::$loads = \Classes\Factory\Model\Model::getLoads();
     self::$massMatrixTable = \Classes\Factory\Model\Model::getMassMatrixTable();
     self::$loadTable = \Classes\Factory\Model\Model::getLoadTable();
     // START
     self::$txt[] = '#include "stdafx.h"';
     self::$txt[] = '#include "Model.h"';
     self::$txt[] = 'Model::Model() {';
     //EXPORT
     self::nodesExport();
     self::memberExport();
     self::restraintExport();
     self::loadCaseExport();
     self::loadExport();
     self::$txt[] = '};';
     file_put_contents($path, implode("\r\n", self::$txt));
 }
 public static function add($object, &$notFoundObjects)
 {
     // get OBJECT
     self::$object = $object;
     // Get NODES, MEMBERS
     self::$nodes = \Classes\Factory\Model\Model::getNodes();
     self::$members = \Classes\Factory\Model\Model::getMembers();
     //Get TABLES
     self::$hashTable = \Classes\Factory\Model\Model::getHashTable();
     self::$loadTable = \Classes\Factory\Model\Model::getLoadTable();
     // Set FOUND to FALSE
     self::$isFound = FALSE;
     self::$loads = array();
     self::$notFoundObject = array();
     //Get Properties
     self::$loadCase = $object->getProperty('loadCase');
     self::$name = $object->getProperty('name');
     $isDirectionCorrect = \Classes\Utils\Load\LoadDirection::get(self::$direction, $object->getProperty('direction')->get());
     if (!$isDirectionCorrect) {
         throw new \Classes\Exception\Factory\Model\Addition\MemberLoadAddition\IncorrectDirectionException('Incorrect Load Direction');
     }
     // Make direction Property
     self::$direction = new \Classes\Value\IntValue(self::$direction);
     self::$x1 = $object->getProperty('x1');
     self::$y1 = $object->getProperty('y1');
     self::$z1 = $object->getProperty('z1');
     self::$value1 = $object->getProperty('value1');
     // Check type of load
     $type = $object->getProperty('type')->get();
     // Load type isn't correct
     if ($type != "C" && $type != "D") {
         throw new \Classes\Exception\Factory\Model\Addition\MemberLoadAddition\IncorrectTypeException('Incorrect Load Type');
     }
     if ($type == "C") {
         // If $object will not be found
         // $object itself will be returned
         self::$notFoundObject = array(self::$object);
         // TRY TO APPLY TO NODE
         self::addNodeConcentratedLoad();
         // TRY TO APPLY TO MEMBER
         if (!self::$isFound) {
             self::addMemberConcentratedLoad();
         }
     }
     if ($type == "D") {
         self::addmemberDistributedLoad();
     }
     foreach (self::$loads as $load) {
         // Set Properties
         $load->setProperty('loadCase', self::$loadCase);
         $load->setProperty('name', self::$name);
         $load->setProperty('direction', self::$direction);
         // Add to model
         \Classes\Factory\Model\Model::addInstance($load);
     }
     // If $object is NOT applied
     if (!self::$isFound) {
         // Return not found objects
         $notFoundObjects = self::$notFoundObject;
         return FALSE;
     }
     return TRUE;
 }