Ejemplo n.º 1
0
        /// Attach a mesh to this assembly.
        //  virtual void AddMesh(std::shared_ptr<fea::ChMesh> mesh);

        /// Attach a ChPhysicsItem object that is not a body, link, or mesh.
        public virtual void AddOtherPhysicsItem(ChPhysicsItem item)
        {
            /* assert(!std::dynamic_pointer_cast<ChBody>(item));
             * assert(!std::dynamic_pointer_cast<ChLink>(item));
             * assert(!std::dynamic_pointer_cast<ChMesh>(item));
             * assert(std::find(std::begin(otherphysicslist), std::end(otherphysicslist), item) == otherphysicslist.end());*/
            // assert(otherphysicslist[i].GetSystem()==nullptr); // should remove from other system before adding here

            // set system and also add collision models to system
            item.SetSystem(system);
            otherphysicslist.Add(item);
        }
Ejemplo n.º 2
0
        /// Attach an arbitrary ChPhysicsItem (e.g. ChBody, ChParticles, ChLink, etc.) to the assembly.
        /// It will take care of adding it to the proper list of bodies, links, meshes, or generic
        /// physic item. (i.e. it calls AddBody(), AddLink(), AddMesh(), or AddOtherPhysicsItem()).
        /// Note, you cannot call Add() during an Update (i.e. items like particle generators that
        /// are already inserted in the assembly cannot call this) because not thread safe; instead,
        /// use AddBatch().
        public void Add(ChPhysicsItem item)
        {
            //ChBody body = new ChBody();
            System.Type body = typeof(ChBody);
            if (body.Equals(item))
            {
                ChBody b = (ChBody)item;
                AddBody(b);
                return;
            }
            System.Type link = typeof(ChLink);
            if (link.Equals(item))
            {
                ChLink l = (ChLink)item;
                AddLink(l);
                return;
            }

            AddOtherPhysicsItem(item);
        }
Ejemplo n.º 3
0
 public ChPhysicsItem(ChPhysicsItem other)
 {
 }