当前位置: 首页>>代码示例>>C++>>正文


C++ Channel类代码示例

本文整理汇总了C++中Channel的典型用法代码示例。如果您正苦于以下问题:C++ Channel类的具体用法?C++ Channel怎么用?C++ Channel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Channel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: idData

int   
BiaxialFiber3d::recvSelf(int commitTag, Channel &theChannel, 
			  FEM_ObjectBroker &theBroker)
{
    // 
    // get tag and material info from an ID
    //

    static ID idData(3);
    int dbTag = this->getDbTag();
    
    if (theChannel.recvID(dbTag, commitTag, idData) < 0)  {
	opserr << "BiaxialFiber3d::recvSelf() -  failed to recv ID data\n";
	return -1;
    }    

    this->setTag(idData(0));

    // 
    // get area and position datafrom a vector
    //
    
    static Vector dData(4);
    if (theChannel.recvVector(dbTag, commitTag, dData) < 0)  {
      opserr << "BiaxialFiber3d::recvSelf() -  failed to recv Vector data\n";
	return -2;
    }        
    area = dData(0);
    as[0] = dData(1);
    as[1] = dData(2);
	R = dData(3);

    //
    // now we do the material stuff
    //
    
    int matClassTag = idData(1);    
    
    // if we have a material, check it is of correct type
    if (theMaterial != 0) {
	  if (matClassTag != theMaterial->getClassTag()) {
	    delete theMaterial;
	    theMaterial = 0;
	  } 
    }

    // if no material we need to get one,
    // NOTE: not an else if in case deleted in if above
    if (theMaterial == 0) {
	  theMaterial = theBroker.getNewNDMaterial(matClassTag);
	  if (theMaterial == 0) {
	    opserr << "BiaxialFiber3d::recvSelf() - " << 
	      "failed to get a UniaxialMaterial of type "<< matClassTag << endln;
	      return -3;
	  }
    }

    // set the materials dbTag and invoke recvSelf on the material
    theMaterial->setDbTag(idData(2));

    // now invoke recvSelf on the material
    if (theMaterial->recvSelf(commitTag, theChannel, theBroker) < 0) {
      opserr << "BiaxialFiber3d::recvSelf() -  the material failed in recvSelf()\n";
	  return -4;
    }    	

    return 0;
}
开发者ID:aceskpark,项目名称:osfeo,代码行数:68,代码来源:BiaxialFiber3d.cpp

示例2: data

int
TrussSection::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
{
  int res;
  int dataTag = this->getDbTag();

  // truss creates a Vector, receives the Vector and then sets the 
  // internal data with the data in the Vector

  static Vector data(11);
  res = theChannel.recvVector(dataTag, commitTag, data);
  if (res < 0) {
    opserr << "WARNING TrussSection::recvSelf() - failed to receive Vector\n";
    return -1;
  }	      

  this->setTag((int)data(0));
  dimension = (int)data(1);
  numDOF = (int)data(2);
  rho = data(5);
  doRayleighDamping = (int)data(6);
  cMass = (int)data(7);

  initialDisp = new double[dimension];
  for (int i=0; i<dimension; i++)
    initialDisp[i] = 0.0;
  
  int initial = 0;
  for (int i=0; i<dimension; i++) {
    if (data(8+i) != 0.0) {
      initial = 1;
    }
  }
  
  if (initial != 0) {
    for (int i=0; i<dimension; i++) {
      initialDisp[i] = data(8+i);
    }    
  }

  // truss now receives the tags of it's two external nodes
  res = theChannel.recvID(dataTag, commitTag, connectedExternalNodes);
  if (res < 0) {
    opserr << "WARNING TrussSection::recvSelf() - " << this->getTag() << " failed to receive ID\n";
    return -2;
  }

  // finally truss creates a new section object of the correct type,
  // sets its database tag and asks this new object to recveive itself.

  int sectClass = (int)data(3);
  int sectDb = (int)data(4);

  // Get new section if null
  if (theSection == 0)
	  theSection = theBroker.getNewSection(sectClass);

  // Check that section is of right type
  else if (theSection->getClassTag() != sectClass) {
	  delete theSection;
	  theSection = theBroker.getNewSection(sectClass);
  }
  
  // Check if either allocation failed
  if (theSection == 0) {
    opserr << "WARNING TrussSection::recvSelf() - " << this->getTag() << 
      " failed to get a blank Section of type " << sectClass << endln;
    return -3;
  }

  theSection->setDbTag(sectDb); // note: we set the dbTag before we receive the Section
  res = theSection->recvSelf(commitTag, theChannel, theBroker);
  if (res < 0) {
    opserr << "WARNING TrussSection::recvSelf() - " << this->getTag() << " failed to receive its Section\n";
    return -3;
  }

  return 0;
}
开发者ID:aceskpark,项目名称:osfeo,代码行数:79,代码来源:TrussSection.cpp

示例3: data

int MP_Joint2D::sendSelf(int commitTag, Channel &theChannel)
{
	Vector data(15);
    int dataTag = this->getDbTag();

    data(0) = this->getTag(); 
    data(1) = nodeRetained;
    data(2) = nodeConstrained;
    data(3) = MainDOF;
	data(4) = AuxDOF;
	data(5) = FixedEnd;
    
	if (constrDOF == 0) data(6) = 0; else data(6) = constrDOF->Size();    
	if (retainDOF == 0) data(7) = 0; else data(7) = retainDOF->Size();        
    if (constraint == 0) data(8) = 0; else data(8) = constraint->noRows();
	if (constraint == 0) data(9) = 0; else data(9) = constraint->noCols();   
    // need two database tags for ID objects
    if (constrDOF != 0 && dbTag1 == 0) dbTag1 = theChannel.getDbTag();
    if (retainDOF != 0 && dbTag2 == 0) dbTag2 = theChannel.getDbTag();
	if (constraint != 0 && dbTag3 == 0) dbTag3 = theChannel.getDbTag();

    data(10) = dbTag1;
    data(11) = dbTag2;
	data(12) = dbTag3;
    data(13) = LargeDisplacement;
    data(14) = Length0;

	// now send the data vector
    int result = theChannel.sendVector(dataTag, commitTag, data);
    if (result < 0) {
		opserr << "WARNING MP_Joint2D::sendSelf - error sending ID data\n";
		return result;  
    }    
    
	// send constrDOF
    if (constrDOF != 0 && constrDOF->Size() != 0) {
		int result = theChannel.sendID(dbTag1, commitTag, *constrDOF);
		if (result < 0) {
			opserr << "WARNING MP_Joint2D::sendSelf ";
			opserr << "- error sending constrained DOF data\n";
			return result;
		}
	}

	// send retainDOF
    if (retainDOF != 0 && retainDOF->Size() != 0) {
		int result = theChannel.sendID(dbTag2, commitTag, *retainDOF);
		if (result < 0) {
			opserr << "WARNING MP_Joint2D::sendSelf ";
			opserr << "- error sending retained DOF data\n";
			return result;
		}
    }

	// send constraint matrix 
    if (constraint != 0 && constraint->noRows() != 0) {


	int result = theChannel.sendMatrix(dbTag3, commitTag, *constraint);
	if (result < 0) {
	    opserr << "WARNING MP_Joint2D::sendSelf ";
	    opserr << "- error sending constraint Matrix data\n"; 
	    return result;  
	}
    }

    return 0;
}
开发者ID:aceskpark,项目名称:osfeo,代码行数:68,代码来源:MP_Joint2D.cpp

示例4: data

int ReinforceConcretePlaneStress::sendSelf(int commitTag, Channel &theChannel)
{
	int res = 0;
    
	int dataTag = this->getDbTag();

	// Packs its data into a Vector and sends this to theChannel
	static Vector data(9);
	data(0) = this->getTag();
	data(1) = rho;
	data(2) = angle1;
	data(3) = angle2;
	data(4) = rou1;
	data(5) = rou2;
	data(6) = fpc;
	data(7) = fy;
	data(8) = E0;
  
	res += theChannel.sendVector(dataTag, commitTag, data);
    if (res < 0) {
      opserr << "WARNING ReinforceConcretePlaneStress::sendSelf() - " << this->getTag() << " failed to send Vector\n";
      return res;
	}	      

	
	// Now sends the IDs of its materials
    int matDbTag;
 
    static ID idData(8);

	// NOTE: to ensure that the material has a database
    // tag if sending to a database channel.

	for (int i=0; i<4; i++)
	{
		idData(i) = theMaterial[i]->getClassTag();
		matDbTag = theMaterial[i]->getDbTag();
		if (matDbTag == 0) {
            matDbTag = theChannel.getDbTag();
			if (matDbTag != 0)
		    theMaterial[i]->setDbTag(matDbTag);
		}
		idData(i+4) = matDbTag;
	}

    res += theChannel.sendID(dataTag, commitTag, idData);
    if (res < 0) {
       opserr << "WARNING ReinforceConcretePlaneStress::sendSelf() - " << this->getTag() << " failed to send ID\n";
       return res;
	}
    
   // Finally, quad asks its material objects to send themselves
   for (int i = 0; i < 4; i++) {
     res += theMaterial[i]->sendSelf(commitTag, theChannel);
    if (res < 0) {
      opserr << "ReinforceConcretePlaneStress::sendSelf() - " << this->getTag() << " failed to send its Material\n";
      return res;
    }
   }	
   
   return res;
}
开发者ID:aceskpark,项目名称:osfeo,代码行数:62,代码来源:ReinforceConcretePlaneStress.cpp

示例5: SoundInstance

	spSoundInstance SoundPlayer::play(Resource *ressound_, bool looping, unsigned int fadeInMS, unsigned int fadeOutMS, float primaryVolume, bool pause, Channel *continueChannel)
	{
		ResSound *ressound = safeCast<ResSound*>(ressound_);
		spSoundInstance s = new SoundInstance();
		s->_player = this;
		if ( primaryVolume < 0.f )
		{
			primaryVolume = _volume;
		}

		if (!ressound || !ressound->getSound())
			return s;

		//printf("PlayResSound:\n");
		Channel *channel = continueChannel;
		if (!channel)
			channel = SoundSystem::instance->getFreeChannel();
		if (!channel)
			return s;


		sound_desc desc;
		desc.sound = ressound->getSound();
		desc.cbDone = _onSoundDone;
		desc.cbAboutEnd = _onSoundAboutDone;
		desc.cbUserData = s.get();
		desc.looping = looping;
		desc.id = ressound->getName();
		desc.volume = primaryVolume;
		desc.paused = pause;



		s->_desc = desc;
		s->_channel = channel;
		s->_startTime = getTime();

		s->_startFadeIn = 0;
		s->_fadeInMS = fadeInMS;

		if (looping)
			s->_startFadeOut = 0;
		else
			s->_startFadeOut = desc.sound->getDuration() - fadeOutMS;

		s->_fadeOutMS = fadeOutMS;

		s->_volume = primaryVolume;	
		s->_state = SoundInstance::Normal;

		if (fadeInMS)
		{
			s->_state = SoundInstance::FadingIn;
			desc.volume = 0.0f;
		}

		_sounds.push_back(s);

		if (continueChannel)
			channel->continuePlay(desc);
		else
			channel->play(desc);

		return s;
	}
开发者ID:gotonis,项目名称:danmake,代码行数:65,代码来源:SoundPlayer.cpp

示例6: startTimer

void ChannelSelector::buttonClicked(Button* button)
{
    //checkChannelSelectors();
    if (button == paramsButton)
    {
        // make sure param buttons are visible
        allButton->setState(true);
        desiredOffset = parameterOffset;
        startTimer(20);
        return;
    }
    else if (button == audioButton)
    {
        // make sure audio buttons are visible

        if (audioButton->getState())
        {
            allButton->setState(false);

            desiredOffset = audioOffset;
            startTimer(20);
        }
        else
        {
            paramsButton->setToggleState(true, dontSendNotification);
        }
        return;
    }
    else if (button == recordButton)
    {
        // make sure record buttons are visible;
        if (recordButton->getState())
        {
            allButton->setState(true);
            desiredOffset = recordOffset;
            startTimer(20);
        }
        else
        {
            paramsButton->setToggleState(true, dontSendNotification);
        }
        return;
    }
    else if (button == allButton)
    {
        // select all active buttons
        if (offsetLR == recordOffset)
        {
            for (int i = 0; i < recordButtonsManager.getNumButtons(); ++i)
            {
                recordButtonsManager.getButtonAt (i)->setToggleState (true, sendNotification);
            }

        }
        else if (offsetLR == parameterOffset)
        {
            for (int i = 0; i < parameterButtonsManager.getNumButtons(); ++i)
            {
                parameterButtonsManager.getButtonAt (i)->setToggleState (true, sendNotification);
            }
        }
        else if (offsetLR == audioOffset)
        {
            // do nothing--> button is disabled
        }
    }
    else if (button == noneButton)
    {
        // deselect all active buttons
        if (offsetLR == recordOffset)
        {
            for (int i = 0; i < recordButtonsManager.getNumButtons(); ++i)
            {
                recordButtonsManager.getButtonAt (i)->setToggleState (false, sendNotification);
            }
        }
        else if (offsetLR == parameterOffset)
        {
            for (int i = 0; i < parameterButtonsManager.getNumButtons(); ++i)
            {
                parameterButtonsManager.getButtonAt (i)->setToggleState (false, sendNotification);
            }
        }
        else if (offsetLR == audioOffset)
        {
            for (int i = 0; i < audioButtonsManager.getNumButtons(); ++i)
            {
                audioButtonsManager.getButtonAt (i)->setToggleState (false, sendNotification);
            }
        }

        if (radioStatus) // if radio buttons are active
        {
            // send a message to parent
            GenericEditor* editor = (GenericEditor*) getParentComponent();
            editor->channelChanged (-1, false);
        }
    }
    else
    {
//.........这里部分代码省略.........
开发者ID:cstawarz,项目名称:open-ephys-plugin-gui,代码行数:101,代码来源:ChannelSelector.cpp

示例7: switch

bool Window::processEvent( const Event& event )
{
    switch( event.type )
    {
        case Event::WINDOW_HIDE:
            setPixelViewport( PixelViewport( 0, 0, 0, 0 ));
            break;

        case Event::WINDOW_SHOW:
        case Event::WINDOW_RESIZE:
            setPixelViewport( PixelViewport( event.resize.x, event.resize.y,
                                             event.resize.w, event.resize.h ));
            break;

        case Event::KEY_PRESS:
        case Event::KEY_RELEASE:
            if( event.key.key == KC_VOID )
                return true; // ignore
            // else fall through
        case Event::WINDOW_EXPOSE:
        case Event::WINDOW_CLOSE:
        case Event::STATISTIC:
        case Event::MAGELLAN_AXIS:
        case Event::MAGELLAN_BUTTON:
            break;

        case Event::WINDOW_POINTER_GRAB:
            _grabbedChannels = _getEventChannels( event.pointer );
            break;
        case Event::WINDOW_POINTER_UNGRAB:
            _grabbedChannels.clear();
            break;

        case Event::WINDOW_POINTER_MOTION:
        case Event::WINDOW_POINTER_BUTTON_PRESS:
        case Event::WINDOW_POINTER_BUTTON_RELEASE:
        case Event::WINDOW_POINTER_WHEEL:
        {
            const Channels& channels = _getEventChannels( event.pointer );
            for( Channels::const_iterator i = channels.begin();
                 i != channels.end(); ++i )
            {
                Channel* channel = *i;
                Event channelEvent = event;
                switch( event.type )
                {
                  case Event::WINDOW_POINTER_MOTION:
                    channelEvent.type = Event::CHANNEL_POINTER_MOTION;
                    break;
                  case Event::WINDOW_POINTER_BUTTON_PRESS:
                    channelEvent.type = Event::CHANNEL_POINTER_BUTTON_PRESS;
                    break;
                  case Event::WINDOW_POINTER_BUTTON_RELEASE:
                    channelEvent.type = Event::CHANNEL_POINTER_BUTTON_RELEASE;
                    break;
                  case Event::WINDOW_POINTER_WHEEL:
                    channelEvent.type = Event::CHANNEL_POINTER_WHEEL;
                    break;
                  default:
                    LBWARN << "Unhandled window event of type " << event.type
                           << std::endl;
                    LBUNIMPLEMENTED;
                }

                // convert y to GL notation (Channel PVP uses GL coordinates)
                const PixelViewport& pvp = getPixelViewport();
                const int32_t y = pvp.h - event.pointer.y;
                const PixelViewport& channelPVP =
                    channel->getNativePixelViewport();

                channelEvent.originator = channel->getID();
                channelEvent.serial = channel->getSerial();
                channelEvent.pointer.x -= channelPVP.x;
                channelEvent.pointer.y = channelPVP.h - y + channelPVP.y;
                channel->processEvent( channelEvent );
            }
            break;
        }

        case Event::WINDOW_SCREENSAVER:
            switch( getIAttribute( IATTR_HINT_SCREENSAVER ))
            {
                case OFF:
                    return true; // screen saver stays inactive
                case ON:
                    return false; // screen saver becomes active
                default: // AUTO
                    if( getDrawableConfig().doublebuffered &&
                        getIAttribute( IATTR_HINT_DRAWABLE ) == WINDOW )
                    {
                        return true; // screen saver stays inactive
                    }
                    return false;
            }

        case Event::UNKNOWN:
            // unknown window-system native event, which was not handled
            return false;

        default:
//.........这里部分代码省略.........
开发者ID:garfy7,项目名称:Equalizer,代码行数:101,代码来源:window.cpp

示例8: data

int 
PySimple1::recvSelf(int cTag, Channel &theChannel, 
			       FEM_ObjectBroker &theBroker)
{
  int res = 0;
  
  static Vector data(39);
  res = theChannel.recvVector(this->getDbTag(), cTag, data);
  
  if (res < 0) {
      opserr << "PySimple1::recvSelf() - failed to receive data\n";
      CNF_tang = 0; 
      this->setTag(0);      
  }
  else {
    this->setTag((int)data(0));
	soilType = (int)data(1);
	pult     = data(2);
	y50      = data(3);
	drag     = data(4);
	dashpot  = data(5);
	yref     = data(6);
	np       = data(7);
	Elast    = data(8);
	nd       = data(9);
	NFkrig   = data(10);

	CNFpinr  = data(11);
	CNFpinl  = data(12);
	CNFyinr  = data(13);
	CNFyinl  = data(14);
	CNF_p    = data(15);
	CNF_y    = data(16);
	CNF_tang = data(17);

	CDrag_pin = data(18);
	CDrag_yin = data(19);
	CDrag_p   = data(20);
	CDrag_y   = data(21);
	CDrag_tang= data(22);

	CClose_yleft = data(23);
	CClose_yright= data(24);
	CClose_p     = data(25);
	CClose_y     = data(26);
	CClose_tang  = data(27);

	CGap_y    = data(28);
	CGap_p    = data(29);
	CGap_tang = data(30);

	CFar_y    = data(31);
	CFar_p    = data(32);
	CFar_tang = data(33);

	Cy        = data(34);
	Cp        = data(35);
	Ctangent  = data(36);
	TyRate    = data(37);
	
	initialTangent = data(38);

	// set the trial quantities
	this->revertToLastCommit();
  }

  return res;
}
开发者ID:aceskpark,项目名称:osfeo,代码行数:68,代码来源:PySimple1.cpp

示例9: idData

int
NormElementRecorder::sendSelf(int commitTag, Channel &theChannel)
{
  addColumnInfo = 1;

  if (theChannel.isDatastore() == 1) {
    opserr << "NormElementRecorder::sendSelf() - does not send data to a datastore\n";
    return -1;
  }

  initializationDone = false;
  //
  // into an ID, place & send (*eleID) size, numArgs and length of all responseArgs
  //

  static ID idData(7);
  if (eleID != 0)
    idData(0) = eleID->Size();
  else
    idData(0) = 0;

  idData(1) = numArgs;

  int msgLength = 0;
  for (int i=0; i<numArgs; i++) 
    msgLength += strlen(responseArgs[i])+1;

  idData(2) = msgLength;

  if (theOutputHandler != 0) {
    idData(3) = theOutputHandler->getClassTag();
  } else 
    idData(3) = 0;

  if (echoTimeFlag == true)
    idData(4) = 1;
  else
    idData(4) = 0;


  idData(5) = this->getTag();
  idData(6) = numDOF;

  if (theChannel.sendID(0, commitTag, idData) < 0) {
    opserr << "NormElementRecorder::sendSelf() - failed to send idData\n";
    return -1;
  }

  static Vector dData(2);
  dData(0) = deltaT;
  dData(1) = nextTimeStampToRecord;
  if (theChannel.sendVector(0, commitTag, dData) < 0) {
    opserr << "NormElementRecorder::sendSelf() - failed to send dData\n";
    return -1;
  }
  
  //
  // send the eleID
  //

  if (eleID != 0)
    if (theChannel.sendID(0, commitTag, *eleID) < 0) {
      opserr << "NormElementRecorder::sendSelf() - failed to send idData\n";
      return -1;
    }

  // send dof
  if (dof != 0)
    if (theChannel.sendID(0, commitTag, *dof) < 0) {
      opserr << "ElementRecorder::sendSelf() - failed to send dof\n";
      return -1;
    }

  //
  // create a single char array holding all strings
  //    will use string terminating character to differentiate strings on other side
  //

  if (msgLength ==  0) {
    opserr << "NormElementRecorder::sendSelf() - no data to send!!\n";
    return -1;
  }

  char *allResponseArgs = new char[msgLength];
  if (allResponseArgs == 0) {
    opserr << "NormElementRecorder::sendSelf() - out of memory\n";
    return -1;
  }

  char *currentLoc = allResponseArgs;
  for (int j=0; j<numArgs; j++) {
    strcpy(currentLoc, responseArgs[j]);
    currentLoc += strlen(responseArgs[j]);
    currentLoc++;
  }

  //
  // send this single char array
  //

//.........这里部分代码省略.........
开发者ID:DBorello,项目名称:OpenSees,代码行数:101,代码来源:NormElementRecorder.cpp

示例10: addValue

	    void RGBColor::addValue(const Channel & channel, double addvalue) {
		if (channel.isPrimaryColorChannel()) {
		    double nowvalue = this->getValue(channel);
		    this->setValue(channel, nowvalue + addvalue);
		}
	    };
开发者ID:beaver999,项目名称:mygoodjob,代码行数:6,代码来源:rgb.cpp

示例11: GetPriority

bool ALSound::SearchFreeBuffer(Sound sound, int &channel, bool &bAlreadyLoaded)
{
    int priority = GetPriority(sound);

    // Seeks a channel used which sound is stopped.
    for (auto it : mChannels) {
        if (it.second->IsPlaying())
            continue;
        if (it.second->GetSoundType() != sound)
            continue;

        it.second->SetPriority(priority);
        channel = it.first;
        bAlreadyLoaded = it.second->IsLoaded();
        return true;
    }

    // just add a new channel if we dont have any
    if (mChannels.size() == 0) {
        Channel *chn = new Channel();
        // check if we channel ready to play music, if not report error
        if (chn->IsReady()) {
            chn->SetPriority(priority);
            mChannels[1] = chn;
            channel = 1;
            bAlreadyLoaded = false;
            return true;
        }
        delete chn;
        GetLogger()->Error("Could not open channel to play sound!");
        return false;
    }

    // Seeks a channel completely free.
    if (mChannels.size() < 64) {
        auto it = mChannels.end();
        it--;
        int i = (*it).first;
        while (++i) {
            if (mChannels.find(i) == mChannels.end()) {
                Channel *chn = new Channel();
                // check if channel is ready to play music, if not destroy it and seek free one
                if (chn->IsReady()) {
                    chn->SetPriority(priority);
                    mChannels[++i] = chn;
                    channel = i;
                    bAlreadyLoaded = false;
                    return true;
                }
                delete chn;
                GetLogger()->Warn("Could not open additional channel to play sound!");
            }
        }
    }

    int lowerOrEqual = -1;
    for (auto it : mChannels) {
        if (it.second->GetPriority() < priority) {
            GetLogger()->Debug("Sound channel with lower priority will be reused.");
            channel = it.first;
            return true;
        }
        if (it.second->GetPriority() <= priority)
            lowerOrEqual = it.first;
    }

    if (lowerOrEqual != -1) {
        channel = lowerOrEqual;
        GetLogger()->Debug("Sound channel with lower or equal priority will be reused.");
        return true;
    }

    GetLogger()->Warn("Could not find free buffer to use.\n");
    return false;
}
开发者ID:pol51,项目名称:colobot,代码行数:75,代码来源:alsound.cpp

示例12: data

int 
ParallelMaterial::recvSelf(int cTag, Channel &theChannel, 
				FEM_ObjectBroker &theBroker)
{
    int res = 0;
    static ID data(3);
    int dbTag = this->getDbTag();

    res = theChannel.recvID(dbTag, cTag, data);
    if (res < 0) {
      opserr << "ParallelMaterial::recvSelf() - failed to receive data\n";
      return res;
    }

    this->setTag(int(data(0)));
    int numMaterialsSent = int(data(1));
    if (numMaterials != numMaterialsSent) { 
      numMaterials = numMaterialsSent;
      if (theModels != 0) {
	for (int i=0; i<numMaterials; i++)
	  delete theModels[i];

	delete [] theModels;
      }

      theModels = new UniaxialMaterial *[numMaterials];      
      if (theModels == 0) {
	opserr << "FATAL ParallelMaterial::recvSelf() - ran out of memory";
	opserr << " for array of size: " << numMaterials << "\n";
	return -2;
      }
      for (int i=0; i<numMaterials; i++)
	theModels[i] = 0;
    }

    if (data(2) == 1) {
        theFactors = new Vector(numMaterials);
        res = theChannel.recvVector(dbTag, cTag, *theFactors);
        if (res < 0) {
            opserr << "ParallelMaterial::recvSelf() - failed to receive factors\n";
        return res;
        }
    }

    // create and receive an ID for the classTags and dbTags of the local 
    // MaterialModel objects
    ID classTags(numMaterials*2);
    res = theChannel.recvID(dbTag, cTag, classTags);
    if (res < 0) {
      opserr << "ParallelMaterial::recvSelf() - failed to receive classTags\n";
      return res;
    }

    // now for each of the MaterialModel objects, create a new object
    // and invoke recvSelf() on it
    for (int i=0; i<numMaterials; i++) {
      int matClassTag = classTags(i);
      if (theModels[i] == 0 || theModels[i]->getClassTag() != matClassTag) {
	if (theModels[i] == 0)
	  delete theModels[i];
	UniaxialMaterial *theMaterialModel = 
	    theBroker.getNewUniaxialMaterial(matClassTag);
	if (theMaterialModel != 0) {
	    theModels[i] = theMaterialModel;
	    theMaterialModel->setDbTag(classTags(i+numMaterials));
	}
	else {
	    opserr << "FATAL ParallelMaterial::recvSelf() ";
	    opserr << " could not get a UniaxialMaterial \n";
	    exit(-1);
	}    	    
      }
      theModels[i]->recvSelf(cTag, theChannel, theBroker);
    }
    return 0;
}
开发者ID:DBorello,项目名称:OpenSees,代码行数:76,代码来源:ParallelMaterial.cpp

示例13: GetIPCChannel

void ServiceProcess::HandleReadEvent()
{
    Channel* ch = GetIPCChannel();
    ch->HandleReadEvent();
}
开发者ID:dawnbreaks,项目名称:arch,代码行数:5,代码来源:service_process.cpp

示例14: data

int ElastomericBearingBoucWen2d::recvSelf(int commitTag, Channel &rChannel,
    FEM_ObjectBroker &theBroker)
{
    // delete material memory
    for (int i=0; i<2; i++)
        if (theMaterials[i] != 0)
            delete theMaterials[i];
    
    // receive element parameters
    static Vector data(21);
    rChannel.recvVector(0, commitTag, data);
    this->setTag((int)data(0));
    k0 = data(1);
    qYield = data(2);
    k2 = data(3);
    k3 = data(4);
    mu = data(5);
    eta = data(6);
    beta = data(7);
    gamma = data(8);
    A = data(9);
    shearDistI = data(10);
    addRayleigh = (int)data(11);
    mass = data(12);
    maxIter = (int)data(13);
    tol = data(14);
    alphaM = data(17);
    betaK = data(18);
    betaK0 = data(19);
    betaKc = data(20);
    
    // receive the two end nodes
    rChannel.recvID(0, commitTag, connectedExternalNodes);
    
    // receive the material class tags
    ID matClassTags(2);
    rChannel.recvID(0, commitTag, matClassTags);
    
    // receive the material models
    for (int i=0; i<2; i++)  {
        theMaterials[i] = theBroker.getNewUniaxialMaterial(matClassTags(i));
        if (theMaterials[i] == 0) {
            opserr << "ElastomericBearingBoucWen2d::recvSelf() - "
                << "failed to get blank uniaxial material.\n";
            return -2;
        }
        theMaterials[i]->recvSelf(commitTag, rChannel, theBroker);
    }
    
    // receive remaining data
    if ((int)data(15) == 3)  {
        x.resize(3);
        rChannel.recvVector(0, commitTag, x);
    }
    if ((int)data(16) == 3)  {
        y.resize(3);
        rChannel.recvVector(0, commitTag, y);
    }
    onP0 = false;
    
    // initialize initial stiffness matrix
    kbInit.Zero();
    kbInit(0,0) = theMaterials[0]->getInitialTangent();
    kbInit(1,1) = A*k0 + k2;
    kbInit(2,2) = theMaterials[1]->getInitialTangent();
    
    // initialize other variables
    this->revertToStart();
    
    return 0;
}
开发者ID:DBorello,项目名称:OpenSeesDev,代码行数:71,代码来源:ElastomericBearingBoucWen2d.cpp

示例15: msgProc

	bool msgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
									
		if(msg == WM_SIZE) {

			updateBounds(hwnd);

		}
		
		if(msg == WM_PAINT) {

			updateBounds(hwnd);

			updateGraph(hwnd);

		}

		if(msg == WM_DESTROY) {
			//SendMessage(GetParent(hwnd), WM_GRAPH_CHANGED, 0, 0);		
			bClosed = true;
		}
		
		if(msg == WM_CREATE) {

			updateGraph(hwnd);

		}

				
		if(msg == WM_LBUTTONDBLCLK) {

//			POINT point;
			//GetCursorPos(&point);


			int xPos = LOWORD(lParam);
			int yPos = HIWORD(lParam);
			
			RECT rect;
			GetClientRect(hwnd, &rect);
			
			if((xPos >= rect.left) && (xPos <= rect.right) && (yPos >= rect.top) && 
				(yPos <= rect.bottom)) 
			{

				float x = toGraphX(xPos);
				float y = toGraphY(rect.bottom - yPos);
				
				for(int i = 0; i < mChannels.size(); i++) {
					Channel* c = &mChannels[i];
					c->insertKey(x);
				}
			}

			updateGraph(hwnd);
		
		}

		if((msg == WM_MOUSEMOVE) && mLocked) {
									
			if(wParam != MK_LBUTTON) {
			
				mLocked = false;
						
			} else {
		
				POINT point;
				
				point.x = LOWORD(lParam);
				point.y = HIWORD(lParam);
				
/*				//GetCursorPos(&point);
								
				RECT rect;
				GetClientRect(hwnd, &rect);
				
				float x = (float)(point.x - rect.left) / (float)(rect.right - rect.left);
				float y = 1.0f - (float)(point.y - rect.top) / (float)(rect.bottom - rect.top);
				float dx = x - mOldX;
				float dy = y - mOldY;
*/				
			RECT rc;
			GetClientRect(hwnd, &rc);

				float x = toGraphX(point.x);
				float y = toGraphY(rc.bottom - point.y);
				
				Channel* c = &mChannels[mLockedChannel];
				
				c->moveKey(x,y,mXTreshold, ymin, ymax);
			
				mOldX = x;
				mOldY = y;

			}

			updateGraph(hwnd);

		}
		

//.........这里部分代码省略.........
开发者ID:DeejStar,项目名称:Shadowgrounds-Redux,代码行数:101,代码来源:graph.cpp


注:本文中的Channel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。