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


C++ ArrayT类代码示例

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


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

示例1: wxASSERT

bool CommandDeleteT::Do()
{
    wxASSERT(!m_Done);
    if (m_Done) return false;

    // Deselect any affected elements that are selected.
    m_CommandSelect->Do();

    ArrayT<MapElementT*> DeletedElems;

    for (unsigned long EntNr=0; EntNr<m_DeleteEnts.Size(); EntNr++)
    {
        m_MapDoc.Remove(m_DeleteEnts[EntNr]);
        DeletedElems.PushBack(m_DeleteEnts[EntNr]);
    }

    for (unsigned long PrimNr=0; PrimNr<m_DeletePrims.Size(); PrimNr++)
    {
        m_MapDoc.Remove(m_DeletePrims[PrimNr]);
        DeletedElems.PushBack(m_DeletePrims[PrimNr]);
    }

    // Update all observers.
    m_MapDoc.UpdateAllObservers_Deleted(DeletedElems);

    m_Done=true;
    return true;
}
开发者ID:mark711,项目名称:Cafu,代码行数:28,代码来源:Delete.cpp

示例2: DefineElements

/* echo element connectivity data */
void SCNIMFT::DefineElements(const ArrayT<StringT>& block_ID, const ArrayT<int>& mat_index) 
{
  const char caller[] = "SCNIMFT::DefineElements";

  //TEMP
  if (block_ID.Length() > 1)
    ExceptionT::GeneralFail(caller, "mutliple block ID's not supported %d",
			    block_ID.Length());
	
  /* access to the model database */
  ModelManagerT& model = ElementSupport().ModelManager();

  fElementConnectivities.Dimension(1);

  // NB THIS IS SPECIALIZED TO ONLY ONE ELEMENT BLOCK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  model.ReadConnectivity(block_ID[0]);

  /* set pointer to connectivity list */
  fElementConnectivities[0] = model.ElementGroupPointer(block_ID[0]);

  // Get nodal coordinates 
  int nsd = NumSD();
  fNodalCoordinates.Dimension(fNodes.Length(), nsd);
  fNodalCoordinates.RowCollect(fNodes, model.Coordinates());

  /* set up element cards for state variable storage */
  fElementCards.Dimension(fNodes.Length()); /* one card per node */
  for (int i = 0; i < fElementCards.Length(); i++)
    fElementCards[i].SetMaterialNumber(mat_index[0]);
	
  fCellGeometry->DefineElements(block_ID, mat_index);
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:33,代码来源:SCNIMFT.cpp

示例3: exec

 TEATREE_FLATTEN
 static void exec(moments_type& p, const moments_type& d, const ArrayT& r)
 {
     p.Oxxx += d.Oxxx + r*(-3*d.Qxx + r*(3*d.Dx - r*d.M));
     p.Oxxy += d.Oxxy - r.yx()*d.Qxx
             + r*(-2*d.Qxy + 2*r.yx()*d.Dx + r*(d.Dx.yx()-r.yx()*d.M));
 }
开发者ID:FreddieWitherden,项目名称:teatree,代码行数:7,代码来源:shift_2d.hpp

示例4: GetBestPage

int InspectorDialogT::GetBestPage(const ArrayT<MapElementT*>& Selection) const
{
    if (Selection.Size()==0)
    {
        // Nothing is selected, so just show the scene graph.
        return 0;
    }
    else if (Selection.Size()==1)
    {
        MapElementT* MapElement=Selection[0];

        return (MapElement->GetType()==&MapEntityT::TypeInfo) ? 1 : 2;
    }
    else
    {
        // Multiple map elements are selected.
        // If we have only map primitives, open the Primitive Properties tab
        // (even though it doesn't make much sense - primitive properties can be edited for a single item only).
        // One or more entities in the selection cause us to open the Entitiy Properties tab.
        bool HaveEntities=false;

        for (unsigned long SelNr=0; SelNr<Selection.Size(); SelNr++)
        {
            MapElementT* MapElement=Selection[SelNr];

            if (MapElement->GetType()==&MapEntityT::TypeInfo)
            {
                HaveEntities=true;
                break;
            }
        }

        return HaveEntities ? 1 : 2;
    }
}
开发者ID:mark711,项目名称:Cafu,代码行数:35,代码来源:DialogInspector.cpp

示例5: while

/*static*/ bool StateT::IsDeltaMessageEmpty(const ArrayT<uint8_t>& DeltaMessage)
{
    if (DeltaMessage[0] == 1)
    {
        // Check the RLE-compressed delta message.
        unsigned int i = 1;

        while (i < DeltaMessage.Size())
        {
            const unsigned int N = DeltaMessage[i];

            i++;

            if (N < MAX_VERBATIM)
            {
                for (unsigned int Stop = i+N+1; i < Stop; i++)
                    if (DeltaMessage[i]) return false;
            }
            else
            {
                if (DeltaMessage[i]) return false;
                i++;
            }
        }
    }
    else
    {
        // Check the uncompressed delta message.
        for (unsigned int i = 1; i < DeltaMessage.Size(); i++)
            if (DeltaMessage[i])
                return false;
    }

    return true;
}
开发者ID:mark711,项目名称:Cafu,代码行数:35,代码来源:State.cpp

示例6: if

template<class T> ArrayT< Polygon3T<T> > Polygon3T<T>::GetSplits(const Plane3T<T>& SplitPlane, const T HalfPlaneThickness) const
{
    const unsigned long FRONT=0;
    const unsigned long BACK =1;

    ArrayT< Polygon3T<T> > Result;

    Result.PushBackEmpty(2);

    Result[FRONT].Plane=this->Plane;
    Result[BACK ].Plane=this->Plane;

    if (!Vertices.Size()) return Result;

    Vector3T<T> LastVertex=Vertices[Vertices.Size()-1];
    double      LastDist  =SplitPlane.GetDistance(LastVertex);

    for (unsigned long VertexNr=0; VertexNr<Vertices.Size(); VertexNr++)
    {
        const Vector3T<T>& ThisVertex=Vertices[VertexNr];
        const double       ThisDist  =SplitPlane.GetDistance(ThisVertex);

        if (ThisDist>HalfPlaneThickness)
        {
            if (LastDist<-HalfPlaneThickness)
            {
                Vector3T<T> Intersection=SplitPlane.GetIntersection(LastVertex, ThisVertex, 0);

                Result[BACK ].Vertices.PushBack(Intersection);
                Result[FRONT].Vertices.PushBack(Intersection);
            }
            else if (LastDist<=HalfPlaneThickness) Result[FRONT].Vertices.PushBack(LastVertex);

            Result[FRONT].Vertices.PushBack(ThisVertex);
        }
        else if (ThisDist<-HalfPlaneThickness)
        {
            if (LastDist>HalfPlaneThickness)
            {
                Vector3T<T> Intersection=SplitPlane.GetIntersection(LastVertex, ThisVertex, 0);

                Result[FRONT].Vertices.PushBack(Intersection);
                Result[BACK ].Vertices.PushBack(Intersection);
            }
            else if (LastDist>=-HalfPlaneThickness) Result[BACK].Vertices.PushBack(LastVertex);

            Result[BACK].Vertices.PushBack(ThisVertex);
        }
        else
        {
                 if (LastDist> HalfPlaneThickness) Result[FRONT].Vertices.PushBack(ThisVertex);
            else if (LastDist<-HalfPlaneThickness) Result[BACK ].Vertices.PushBack(ThisVertex);
        }

        LastVertex=ThisVertex;
        LastDist  =ThisDist;
    }

    return Result;
}
开发者ID:mark711,项目名称:Cafu,代码行数:60,代码来源:Polygon.cpp

示例7: WaitReceive

/* return the index the next receive */
void CommunicatorT::WaitReceive(const ArrayT<MPI_Request>& requests, int& index, int& source) const
{
	const char caller[] = "CommunicatorT::WaitReceive";
	Log(kModerate, caller, "waiting for 1 of %d", requests.Length());

	index = source = -1;

#ifdef __TAHOE_MPI__
	/* grab completed receive */
	MPI_Status status;
	int ret = MPI_Waitany(requests.Length(), (MPI_Request*) requests.Pointer(), &index, &status);

#ifdef CHECK_MPI_RETURN
	if (ret != MPI_SUCCESS) Log(kFail, caller, "MPI_Waitany failed");
#endif

#ifdef CHECK_MPI_STATUS
	if (status.MPI_ERROR != MPI_SUCCESS) Log(kFail, caller, "bad status: %d", status.MPI_ERROR);
#endif
	
	source = status.MPI_SOURCE;
#endif

	Log(kModerate, caller, "received request at index %d from %d", index, source);
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:26,代码来源:CommunicatorT.cpp

示例8: DetermineAdjacencyGraph

// This function determines the adjacency cell graph of the 'SuperLeaves'.
// It is filled-in and stored in the 'Neighbours' members/components of the 'SuperLeaves'.
// After this function was called, all components of all 'SuperLeaves' are completely filled-in.
void DetermineAdjacencyGraph()
{
    for (unsigned long SL1Nr=0; SL1Nr<SuperLeaves.Size(); SL1Nr++)
        for (unsigned long SL2Nr=0; SL2Nr<SuperLeaves.Size(); SL2Nr++)
        {
            if (SL1Nr==SL2Nr || !SuperLeaves[SL1Nr].BB.GetEpsilonBox(MapT::RoundEpsilon).Intersects(SuperLeaves[SL2Nr].BB)) continue;

            // Jedes Portal des ersten Leafs gegen jedes Portal des zweiten Leafs
            // prüfen und testen, ob sie sich schneiden (dann sind sie durchlässig).
            // BEACHTE: SuperLeaves haben *alle* Portale von *allen* ihrer Leaves!
            // D.h. es können sich nicht nur Portale auf ihrer konvexen Hülle befinden, sondern auch "innen drin".
            // Wegen der Konvexität der SuperLeaves dürfte das aber keine Rolle spielen und folgendes müßte trotzdem korrekt funktionieren.
            for (unsigned long Portal1Nr=0; Portal1Nr<SuperLeaves[SL1Nr].Portals.Size(); Portal1Nr++)
                for (unsigned long Portal2Nr=0; Portal2Nr<SuperLeaves[SL2Nr].Portals.Size(); Portal2Nr++)
                {
                    if (!SuperLeaves[SL1Nr].Portals[Portal1Nr].Overlaps(SuperLeaves[SL2Nr].Portals[Portal2Nr], false, MapT::RoundEpsilon)) continue;

                    // Folgender Check ist zwar redundant, aber zumindest sinnvoll.
                    // Da diese Funktion sowieso schnell genug ist, lasse ihn nicht weg!
                    if (SuperLeaves[SL1Nr].Portals[Portal1Nr].WhatSide(SuperLeaves[SL2Nr].Portals[Portal2Nr].Plane, MapT::RoundEpsilon)!=Polygon3T<double>::InMirrored) continue;

                    ArrayT< Polygon3T<double> > NewPortals;
                    SuperLeaves[SL1Nr].Portals[Portal1Nr].GetChoppedUpAlong(SuperLeaves[SL2Nr].Portals[Portal2Nr], MapT::RoundEpsilon, NewPortals);

                    SuperLeaves[SL1Nr].Neighbours.PushBackEmpty();
                    SuperLeaves[SL1Nr].Neighbours[SuperLeaves[SL1Nr].Neighbours.Size()-1].SuperLeafNr=SL2Nr;
                    SuperLeaves[SL1Nr].Neighbours[SuperLeaves[SL1Nr].Neighbours.Size()-1].SubPortal  =NewPortals[NewPortals.Size()-1];
                }
        }

    printf("SLs Adjacency Graph :       done\n");
}
开发者ID:mark711,项目名称:Cafu,代码行数:35,代码来源:CaPVS.cpp

示例9: wxASSERT

bool CommandGroupSetPropT::Do()
{
    wxASSERT(!m_Done);
    if (m_Done) return false;

    // Set the new property
    // and notify all observers that our groups inventory changed.
    switch (m_Prop)
    {
        case PROP_NAME:          m_Group->Name=m_NewName;          break;
        case PROP_COLOR:         m_Group->Color=m_NewColor;        break;
        case PROP_CANSELECT:     m_Group->CanSelect=m_NewFlag;     break;
        case PROP_SELECTASGROUP: m_Group->SelectAsGroup=m_NewFlag; break;
    }

    m_MapDoc.UpdateAllObservers_GroupsChanged();

    // If the elements in the group have changed color, update all observers accordingly.
    if (m_Prop==PROP_COLOR)
    {
        const ArrayT<MapElementT*> GroupElems=m_Group->GetMembers(m_MapDoc);

        if (GroupElems.Size()>0)
            m_MapDoc.UpdateAllObservers_Modified(GroupElems, MEMD_GENERIC /*MEMD_VISIBILITY*/);
    }

    m_Done=true;
    return true;
}
开发者ID:mark711,项目名称:Cafu,代码行数:29,代码来源:Group_SetProp.cpp

示例10: StringToArray

inline void StringToArray(LPCTSTR text, ArrayT & array, LPCTSTR separator = _T(""), bool trimSpaces = true)
{
    CString search = text;
    int seplen = CString(separator).GetLength();
    while (true)
    {
        int idx = search.Find(separator);
        if (idx == -1)
        {
            if (trimSpaces)
            {
                search.TrimLeft();
                search.TrimRight();
            }
            if (!search.IsEmpty())
                array.Add(search);
            break;
        }
        CString part = search.Left(idx);
        search.Delete(0, idx + seplen);
        if (trimSpaces)
        {
            part.TrimLeft();
            part.TrimRight();
        }
        if (!part.IsEmpty())
            array.Add(part);
    }
}
开发者ID:ohosrry,项目名称:visualfc,代码行数:29,代码来源:vsnet_addin.cpp

示例11: SetActiveElementGroupMask

/* change the number of active element groups */
void ElementListT::SetActiveElementGroupMask(const ArrayT<bool>& mask)
{
	/* first time */
	if (fAllElementGroups.Length() == 0)
	{
		/* cache all pointers */
		fAllElementGroups.Dimension(Length());
		for (int i = 0; i < fAllElementGroups.Length(); i++)
		{
			ElementBaseT* element = (*this)[i];
			fAllElementGroups[i] = element;
		}
	}

	/* check */
	if (mask.Length() != fAllElementGroups.Length())
		ExceptionT::SizeMismatch("ElementListT::SetActiveElementGroupMask",
			"expecting mask length %d not %d", fAllElementGroups.Length(), mask.Length());

	/* reset active element groups */
	int num_active = 0;
	for (int i = 0; i < mask.Length(); i++)
		if (mask[i])
			num_active++;

	/* cast this to an ArrayT */
	ArrayT<ElementBaseT*>& element_list = *this;
	element_list.Dimension(num_active);
	num_active = 0;
	for (int i = 0; i < mask.Length(); i++)
		if (mask[i])
			element_list[num_active++] = fAllElementGroups[i];
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:34,代码来源:ElementListT.cpp

示例12: Tokenizer

bool EditorChoiceWindowT::HandlePGChange(wxPropertyGridEvent& Event, GuiEditor::ChildFrameT* ChildFrame)
{
    if (EditorWindowT::HandlePGChange(Event, ChildFrame)) return true;

    const wxPGProperty* Prop    =Event.GetProperty();
    const wxString      PropName=Prop->GetName();

    if (PropName=="Choices")
    {
        ArrayT<std::string> NewStrings;
        wxStringTokenizer   Tokenizer(Prop->GetValueAsString(), "\r\n");

        while (Tokenizer.HasMoreTokens())
            NewStrings.PushBack(std::string(Tokenizer.GetNextToken()));

        ChildFrame->SubmitCommand(new CommandSetWinPropT< ArrayT<std::string> >(m_GuiDoc, this, PropName, m_Choice->m_Choices, NewStrings));
        return true;
    }

    if (PropName=="DefaultChoice")
    {
        wxASSERT(m_Choice->GetMemberVar("selectedChoice").Member!=NULL);

        ChildFrame->SubmitCommand(new CommandModifyWindowT(m_GuiDoc, m_Choice, PropName, m_Choice->GetMemberVar("selectedChoice"), Prop->GetValue().GetLong()));
        return true;
    }

    return false;
}
开发者ID:mark711,项目名称:Cafu,代码行数:29,代码来源:EditorChoiceWindow.cpp

示例13:

bool ToolEditSurfaceT::OnLMouseDown3D(ViewWindow3DT& ViewWindow, wxMouseEvent& ME)
{
    const ArrayT<ViewWindow3DT::HitInfoT> Hits=ViewWindow.GetElementsAt(ME.GetPosition());

    // Having this statement here means that the user absolutely cannot entirely clear the
    // surfaces selection (in 3D views, it works in 2D views), but that is just fine - why would he?
    if (Hits.Size()==0) return true;

    MapElementT*  Object   =Hits[0].Object;
    unsigned long FaceIndex=Hits[0].FaceNr;

    if (m_EyeDropperActive)
    {
        ViewWindow.GetChildFrame()->GetSurfacePropsDialog()->EyeDropperClick(Object, FaceIndex);
        return true;
    }

    if (!ME.ControlDown())
        ViewWindow.GetChildFrame()->GetSurfacePropsDialog()->ClearSelection();

    ViewWindow.GetChildFrame()->GetSurfacePropsDialog()->ToggleClick(Object, ME.ShiftDown() ? EditSurfacePropsDialogT::ALL_FACES : FaceIndex);

    // When something is newly selected (Control is not down), its surface properties are also picked up.
    if (!ME.ControlDown())
        ViewWindow.GetChildFrame()->GetSurfacePropsDialog()->EyeDropperClick(Object, FaceIndex);

    return true;
}
开发者ID:mark711,项目名称:Cafu,代码行数:28,代码来源:ToolEditSurface.cpp

示例14: UpdateAllObservers_Modified

void SubjectT::UpdateAllObservers_Modified(IntrusivePtrT<cf::GuiSys::WindowT> Window, WindowModDetailE Detail, const wxString& PropertyName)
{
    ArrayT< IntrusivePtrT<cf::GuiSys::WindowT> > Windows;
    Windows.PushBack(Window);

    UpdateAllObservers_Modified(Windows, Detail, PropertyName);
}
开发者ID:mark711,项目名称:Cafu,代码行数:7,代码来源:ObserverPattern.cpp

示例15: ElementSupport

void MFPenaltyContact2DT::ComputeStrikerCoordinates(const ArrayT<int>& strikers)
{
	/* dimension */
	fStrikerCoords_man.SetMajorDimension(strikers.Length(), false);

	/* current striker coords */
	if (strikers.Length() > 0) {
	
		/* reconstruct displacement field */
		if (fSCNI) {
			fSCNI_tmp = strikers;
			if (!fSCNI->GlobalToLocalNumbering(fSCNI_tmp))
				ExceptionT::GeneralFail("MFPenaltyContact2DT::ComputeStrikerCoordinates", 
					"SCNI global->local failed");
			fSCNI->InterpolatedFieldAtNodes(fSCNI_tmp, fStrikerCoords);
		}
		else {
			iArrayT tmp;
			tmp.Alias(strikers);
			fElementGroup->NodalDOFs(tmp, fStrikerCoords);
		}

		/* compute current coordinates */
		const dArray2DT& init_coords = ElementSupport().InitialCoordinates();
		for (int i = 0; i < strikers.Length(); i++)
			fStrikerCoords.AddToRowScaled(i, 1.0, init_coords(strikers[i]));
	}
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:28,代码来源:MFPenaltyContact2DT.cpp


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