tmp<GeometricField<Type, tetPolyPatchField, tetPointMesh> >
tetPointFieldReconstructor::reconstructTetPointField
(
    const IOobject& fieldIoObject
)
{
    // Read the field for all the processors
    PtrList<GeometricField<Type, tetPolyPatchField, tetPointMesh> > procFields
    (
        procMeshes_.size()
    );

    forAll (procMeshes_, procI)
    {
        procFields.set
        (
            procI,
            new GeometricField<Type, tetPolyPatchField, tetPointMesh>
            (
                IOobject
                (
                    fieldIoObject.name(),
                    procMeshes_[procI]().time().timeName(),
                    procMeshes_[procI](),
                    IOobject::MUST_READ,
                    IOobject::NO_WRITE
                ),
                procMeshes_[procI]
            )
        );
    }
Beispiel #2
0
void CSearchResultDlg::displayPage(int page, BOOL showStatus)
{
	if (page < 0 || page >= pageCount)
		return;

	if (showStatus) {
		CString str;
		str.Format(IDS_SEARCH_PAGE_NO, page + 1);
		SetDlgItemText(IDC_STATUS, str);
	}

	PtrList *l = pages[page];
	PtrList::iterator it;
	for (it = l->begin(); it != l->end(); ++it) {
		SEARCH_RESULT *p = (SEARCH_RESULT *) *it;

		int image = p->face;
		if (!p->online)
			image += NR_FACES;
		CString str;
		str.Format("%lu", p->uin);
		int i = m_ctlResult.InsertItem(m_ctlResult.GetItemCount(), str, image);
		m_ctlResult.SetItemData(i, (DWORD) p);
		m_ctlResult.SetItemText(i, 1, p->nick.c_str());
		m_ctlResult.SetItemText(i, 2, p->province.c_str());
	}
}
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
Foam::fvFieldReconstructor::reconstructFvVolumeField
(
    const IOobject& fieldIoObject
)
{
    // Read the field for all the processors
    PtrList<GeometricField<Type, fvPatchField, volMesh> > procFields
    (
        procMeshes_.size()
    );

    forAll (procMeshes_, procI)
    {
        procFields.set
        (
            procI,
            new GeometricField<Type, fvPatchField, volMesh>
            (
                IOobject
                (
                    fieldIoObject.name(),
                    procMeshes_[procI].time().timeName(),
                    procMeshes_[procI],
                    IOobject::MUST_READ,
                    IOobject::NO_WRITE
                ),
                procMeshes_[procI]
            )
        );
    }
Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh>>
Foam::pointFieldReconstructor::reconstructField(const IOobject& fieldIoObject)
{
    // Read the field for all the processors
    PtrList<GeometricField<Type, pointPatchField, pointMesh>> procFields
    (
        procMeshes_.size()
    );

    forAll(procMeshes_, proci)
    {
        procFields.set
        (
            proci,
            new GeometricField<Type, pointPatchField, pointMesh>
            (
                IOobject
                (
                    fieldIoObject.name(),
                    procMeshes_[proci]().time().timeName(),
                    procMeshes_[proci](),
                    IOobject::MUST_READ,
                    IOobject::NO_WRITE
                ),
                procMeshes_[proci]
            )
        );
    }
Foam::tmp<Foam::DimensionedField<Type, Foam::volMesh>>
Foam::fvFieldReconstructor::reconstructFvVolumeInternalField
(
    const IOobject& fieldIoObject
) const
{
    // Read the field for all the processors
    PtrList<DimensionedField<Type, volMesh>> procFields
    (
        procMeshes_.size()
    );

    forAll(procMeshes_, proci)
    {
        procFields.set
        (
            proci,
            new DimensionedField<Type, volMesh>
            (
                IOobject
                (
                    fieldIoObject.name(),
                    procMeshes_[proci].time().timeName(),
                    procMeshes_[proci],
                    IOobject::MUST_READ,
                    IOobject::NO_WRITE
                ),
                procMeshes_[proci]
            )
        );
    }
 // remove vp from the list
 void Remove(T *ip)
 {
   PtrList *p = Find(ip);
   if (p)
   {
     p->Remove();
   }
 }
 void Add(T *ip)
 {
   PtrList *pl = this;
   while (pl && pl->m_pNext)
   {
     pl = pl->Next();
   }
   pl->m_pNext = new PtrList(ip);
 }
Beispiel #8
0
//###########################################
CPAGE_FUNC(Bool32)  CPAGE_DeleteAll()
{
	CPAGE_CONVERTOR ConvertorPages = {0,DefConvertPage}; // Piter
	PROLOG;
	Bool32 rc = TRUE;
	Page.Clear();
	NameData.Clear();
	SetConvertorPages(ConvertorPages); // Piter
	hCurPage = NULL;
	EPILOG;
	return rc;
}
Beispiel #9
0
//###########################################
CPAGE_FUNC(Handle)  CPAGE_GetInternalType(const char * name)
{
	PROLOG;
	Handle rc = 0;
	NAMEDATA nd(name);
	SetReturnCode_cpage(IDS_ERR_NO);
	rc = NameData.FindFirst(nd);
	if(!rc)
		rc = NameData.AddTail(nd);
	EPILOG;
	return rc;
}
Beispiel #10
0
void CSearchResultDlg::deleteResults()
{
	for (int i = 0; i < pageCount; i++) {
		PtrList *l = pages[i];
		PtrList::iterator it;
		for (it = l->begin(); it != l->end(); ++it)
			delete (SEARCH_RESULT *) *it;
		l->clear();
	}
	curPage = -1;
	pageCount = 0;
	startUIN = 0;
}
Tile CMapTile::GetTile(CVector Pos, CMap* pMap)
{
	PtrList<CEntity*> EntityList = pMap->GetTileEntityList(Pos);
	if(!EntityList.empty()) {
		if(ContainsPlayer(EntityList))
			return pMap->GetPlayer()->GetTile(pMap);
		else if(ContainsMobs(EntityList)) {
			PtrList<CEntity*> MobList = FilterMobEntities(EntityList);
			return MobList[0]->GetTile(pMap);
		} else
			return EntityList[0]->GetTile(pMap);
	}
	else return FloorTile;
}
Beispiel #12
0
void CGroupSearchResultPage::onGroupListReply(PtrList &l)
{
	CGroupSearchWizard *wiz = (CGroupSearchWizard *) GetParent();
	int type = wiz->typePage.getGroupType();

	PtrList::iterator it;
	for (it = l.begin(); it != l.end(); ++it) {
		GROUP_INFO *p = (GROUP_INFO *) *it;
		p->type = type;
		addResult(p);
	}

	GetDlgItem(IDC_REFRESH)->EnableWindow();
}
Beispiel #13
0
//###########################################
CPAGE_FUNC(Handle)  CPAGE_RestorePage(Bool32 remove,char * lpName)
{
	PROLOG;
	Handle rc = NULL;
	Bool decompress=FALSE;

	SetReturnCode_cpage(IDS_ERR_NO);

	Handle file = myOpenRestore((char *)lpName);
	if(file)
	{
		int i;
		int count;

		uint32_t vers = 0;
		if(myRead(file,&vers,sizeof(vers))==sizeof(vers))
		{
			if (vers==VERSION_FILE_COMPRESSED)
			   decompress=TRUE;
			else
				if(vers!=VERSION_FILE)
				{
					SetReturnCode_cpage(IDS_ERR_OLDFILEVERSION);
					myClose(file);
					return FALSE;
				}
			{
				if(remove)
				{
					Page.Clear();
					NameData.Clear();
				}

				if(myRead(file,&count,sizeof(count))==sizeof(count))
					for(i=0;i<count ;i++)
					{
						BACKUPPAGE page;
						if(decompress ? page.RestoreCompress(file) : page.Restore(file))
							rc = Page.AddTail(page);
						else
							break;
					}
			}
		}
		myClose(file);
	}
	EPILOG;
return rc;
}
bool CMapTile::IsPassable(CVector Pos, CMap* pMap, CEntity* pTrespasser)
{
	if(!Flags.Is_Set(MTF_PASSABLE))
		return false;
	else {
		PtrList<CEntity*> EntityList = pMap->GetTileEntityList(Pos);
		for(Uint16 i=0;i<EntityList.size();i++) {
			if(EntityList[i] == pTrespasser)
				continue;
			if(EntityList[i]->EntityFlags.Is_Set(EF_MOB))
				return false;
		}
	}
	return true;
}
Beispiel #15
0
void LAgreementDlg::redraw() {
  XClearWindow(xvars->dpy[dpyNum],window);

  // Loop over all lines on current page.
  Page* page = (Page*)pages.get(currentPage);
  const PtrList& lines = page->get_lines();  
  for (int n = 0; n < lines.length(); n++) {
    int length;
    const char* text = ((Line*)lines.get(n))->get_text(length);
    if (length > 0) {
      XDrawString(xvars->dpy[dpyNum],window,xvars->gc[dpyNum],
                  TEXT_PADDING,
                  TEXT_PADDING 
                  + xvars->font[dpyNum]->max_bounds.ascent 
                  + fontSize.height * n,
                  text,length);                           
    }
  }

  // Draw separators.
  XDrawLine(xvars->dpy[dpyNum],window,xvars->gc[dpyNum],
            0,separatorY_1,windowSize.width - 1,separatorY_1);
  XDrawLine(xvars->dpy[dpyNum],window,xvars->gc[dpyNum],
            0,separatorY_2,windowSize.width - 1,separatorY_2);

  // Buttons will redraw themselves.
}
void CMapTile::OnExamine(CVector Pos, CMap* pMap, CEntity* pActor)
{
	PtrList<CEntity*> EntityList = pMap->GetTileEntityList(Pos);
	if(!EntityList.empty()) {
		ExamineEntitieList(EntityList);
		return;
	}

	if(this == EmptyTile) {
		gMessages.AddMessage("Du schaust in die Weiten des Weltraums WTF!");
		return;
	}
	if(!Flags.Is_Set(MTF_PASSABLE))
		gMessages.AddMessage("Du schaust auf ein Stueck feste Wand");
	else gMessages.AddMessage("Du kannst dich hier hinbewegen");
}
void Foam::lagrangianFieldDecomposer::readFields
(
    const label cloudI,
    const IOobjectList& lagrangianObjects,
    PtrList<PtrList<IOField<Type> > >& lagrangianFields
)
{
    // Search list of objects for lagrangian fields
    IOobjectList lagrangianTypeObjects
    (
        lagrangianObjects.lookupClass(IOField<Type>::typeName)
    );

    lagrangianFields.set
    (
        cloudI,
        new PtrList<IOField<Type> >
        (
            lagrangianTypeObjects.size()
        )
    );

    label lagrangianFieldi = 0;
    forAllIter(IOobjectList, lagrangianTypeObjects, iter)
    {
        lagrangianFields[cloudI].set
        (
            lagrangianFieldi++,
            new IOField<Type>(*iter())
        );
    }
    forAll (procMeshes_, procI)
    {
        const GeometricField<Type, tetPolyPatchField, tetPointMesh>&
            procField = procFields[procI];

        // Get processor-to-global addressing for use in rmap
        labelList procToGlobalAddr = procAddressing(procI);

        // Set the cell values in the reconstructed field
        internalField.rmap
        (
            procField.internalField(),
            procToGlobalAddr
        );

        // Set the boundary patch values in the reconstructed field
        forAll(boundaryProcAddressing_[procI], patchI)
        {
            // Get patch index of the original patch
            const label curBPatch = boundaryProcAddressing_[procI][patchI];

            // check if the boundary patch is not a processor patch
            if (curBPatch >= 0)
            {
                if (!patchFields(curBPatch))
                {
                    patchFields.set
                    (
                        curBPatch,
                        tetPolyPatchField<Type>::New
                        (
                            procField.boundaryField()[patchI],
                            mesh_.boundary()[curBPatch],
                            DimensionedField<Type, tetPointMesh>::null(),
                            tetPolyPatchFieldReconstructor
                            (
                                mesh_.boundary()[curBPatch].size(),
                                procField.boundaryField()[patchI].size()
                            )
                        )
                    );
                }

                // If the field stores values, do the rmap
                if (patchFields[curBPatch].storesFieldData())
                {
                    patchFields[curBPatch].rmap
                    (
                        procField.boundaryField()[patchI],
                        procPatchAddressing
                        (
                            procToGlobalAddr,
                            procI,
                            patchI
                        )
                    );
                }
            }
        }
    }
                // In processor patches, there's a mix of internal faces (some
                // of them turned) and possible cyclics. Slow loop
                forAll (cp, faceI)
                {
                    // Subtract one to take into account offsets for
                    // face direction.
                    label curF = cp[faceI] - 1;

                    // Is the face on the boundary?
                    if (curF >= mesh_.nInternalFaces())
                    {
                        label curBPatch =
                            mesh_.boundaryMesh().whichPatch(curF);

                        if (!patchFields(curBPatch))
                        {
                            patchFields.set
                            (
                                curBPatch,
                                fvPatchField<Type>::New
                                (
                                    mesh_.boundary()[curBPatch].type(),
                                    mesh_.boundary()[curBPatch],
                                    DimensionedField<Type, volMesh>::null()
                                )
                            );
                        }

                        // add the face
                        label curPatchFace =
                            mesh_.boundaryMesh()
                                [curBPatch].whichFace(curF);

                        patchFields[curBPatch][curPatchFace] =
                            curProcPatch[faceI];
                    }
                }
Beispiel #20
0
void subsetSurfaceFields
(
    const fvMeshSubset& subsetter,
    const wordList& fieldNames,
    PtrList<GeometricField<Type, fvsPatchField, surfaceMesh> >& subFields
)
{
    const fvMesh& baseMesh = subsetter.baseMesh();

    forAll(fieldNames, i)
    {
        const word& fieldName = fieldNames[i];

        Info<< "Subsetting field " << fieldName << endl;

        GeometricField<Type, fvsPatchField, surfaceMesh> fld
        (
            IOobject
            (
                fieldName,
                baseMesh.time().timeName(),
                baseMesh,
                IOobject::MUST_READ,
                IOobject::NO_WRITE
            ),
            baseMesh
        );

        subFields.set(i, subsetter.interpolate(fld));
    }
}
Beispiel #21
0
    bool addFieldsToList
    (
        const fvMesh& mesh,
        PtrList<GeometricField<Type, fvPatchField, volMesh> >& list,
        const wordList& fieldNames
    )
    {
        typedef GeometricField<Type, fvPatchField, volMesh> fieldType;

        label index = 0;
        forAll(fieldNames, i)
        {
            IOobject obj
            (
                fieldNames[i],
                mesh.time().timeName(),
                mesh,
                IOobject::MUST_READ
            );

            if (obj.headerOk() && obj.headerClassName() == fieldType::typeName)
            {
                list.set(index++, new fieldType(obj, mesh));
            }
            else
            {
                Info<< "Could not find " << fieldNames[i] << endl;

                return false;
            }
        }
Beispiel #22
0
//###########################################
CPAGE_FUNC(Handle)  CPAGE_GetHandlePage(uint32_t page)
{
	PROLOG;
	Handle rc = Page.GetHandle(page);
	EPILOG;
	return rc;
}
void readFields
(
    PtrList<List<Type> >& values,
    const List<word>& fieldNames,
    const IOobjectList& cloudObjs
)
{
    IOobjectList objects(cloudObjs.lookupClass(IOField<Type>::typeName));

    forAll(fieldNames, j)
    {
        const IOobject* obj = objects.lookup(fieldNames[j]);
        if (obj != NULL)
        {
            Info<< "        reading field " << fieldNames[j] << endl;
            IOField<Type> newField(*obj);
            values.set(j, new List<Type>(newField.xfer()));
        }
        else
        {
            FatalErrorIn
            (
                "template<class Type>"
                "void readFields"
                "("
                    "PtrList<List<Type> >&, "
                    "const List<word>&, "
                    "const IOobjectList&"
                ")"
            )
                << "Unable to read field " << fieldNames[j]
                << abort(FatalError);
        }
    }
}
// Read the number of layers from dictionary. Per patch 0 or the number
// of layers.
Foam::labelList Foam::layerParameters::readNumLayers
(
    const PtrList<dictionary>& surfaceDicts,
    const refinementSurfaces& refineSurfaces,
    const labelList& globalToPatch,
    const polyBoundaryMesh& boundaryMesh
)
{
    // Per surface the number of layers
    labelList globalSurfLayers(surfaceDicts.size());
    // Per surface, per region the number of layers
    List<Map<label> > regionSurfLayers(surfaceDicts.size());

    const labelList& surfaceIndices = refineSurfaces.surfaces();

    forAll(surfaceDicts, surfI)
    {
        const dictionary& dict = surfaceDicts[surfI];

        globalSurfLayers[surfI] = readLabel(dict.lookup("surfaceLayers"));

        if (dict.found("regions"))
        {
            // Per-region layer information

            PtrList<dictionary> regionDicts(dict.lookup("regions"));

            const wordList& regionNames =
                refineSurfaces.geometry()[surfaceIndices[surfI]].regions();

            forAll(regionDicts, dictI)
            {
                const dictionary& regionDict = regionDicts[dictI];

                const word regionName(regionDict.lookup("name"));

                label regionI = findIndex(regionNames, regionName);

                label nLayers = readLabel(regionDict.lookup("surfaceLayers"));

                Info<< "    region " << regionName << ':'<< nl
                    << "        surface layers:" << nLayers << nl;

                regionSurfLayers[surfI].insert(regionI, nLayers);
            }
        }
    }
Beispiel #25
0
//###########################################
CPAGE_FUNC(uint32_t) CPAGE_GetCountPage()
{
	PROLOG;
	SetReturnCode_cpage(IDS_ERR_NO);
	uint32_t rc = Page.GetCount();
	EPILOG;
	return rc;
}
Beispiel #26
0
void XETP::send_objects(OutStreamP out,const PtrList &physicals,
                        Turn turn,const PtrList &tickTypes) {
  assert(physicals.length() == tickTypes.length());
  u_int totalLen = 0;
  int n;
  for (n = 0; n < physicals.length(); n++) {
    totalLen += 
      XETP::add_header(compute_object_length((PhysicalP)physicals.get(n)));
  }

  // length passed into UDP prepare_packet is bigger than the lengths 
  // passed into each XETP packet.
  if (out->get_protocol() == GenericStream::UDP) {
    ((UDPOutStreamP)out)->prepare_packet(totalLen);
  }
  
  // Send each object in turn.
  for (n = 0; n < physicals.length(); n++) {
    PhysicalP p = (PhysicalP)physicals.get(n);
    // computing object_length twice, but who cares.
    _send_object(out,p,turn,(TickType)(size_t)tickTypes.get(n),
                 compute_object_length(p));
  }
  
  if (out->get_protocol() == GenericStream::UDP) {
    ((UDPOutStreamP)out)->done_packet();
  }      
}
Beispiel #27
0
//###########################################
CPAGE_FUNC(void) CPAGE_DeletePage(Handle page)
{
	PROLOG;
	SetReturnCode_cpage(IDS_ERR_NO);
	Page.Del(page);
	if(hCurPage == page)
		hCurPage = NULL;
	EPILOG;
}
Beispiel #28
0
//###########################################
CPAGE_FUNC(uint32_t)  CPAGE_GetNumberPage( Handle hPage )
{
	PROLOG;
	uint32_t rc = (uint32_t)-1;
	if(hPage)
		rc = (uint32_t)Page.GetPos(hPage);
	EPILOG;
	return rc;
}
Beispiel #29
0
void readFields
(
    const vtkMesh& vMesh,
    const typename GeoField::Mesh& mesh,
    const IOobjectList& objects,
    const HashSet<word>& selectedFields,
    PtrList<GeoField>& fields
)
{
    // Search list of objects for volScalarFields
    IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));

    // Construct the vol scalar fields
    label nFields = fields.size();
    fields.setSize(nFields + fieldObjects.size());

    for
    (
        IOobjectList::iterator iter = fieldObjects.begin();
        iter != fieldObjects.end();
        ++iter
    )
    {
        if (selectedFields.empty() || selectedFields.found(iter()->name()))
        {
            fields.set
            (
                nFields,
                vMesh.interpolate
                (
                    GeoField
                    (
                        *iter(),
                        mesh
                    )
                )
            );
            nFields++;
        }
    }

    fields.setSize(nFields);
}
Beispiel #30
0
//###########################################
CPAGE_FUNC(char *)  CPAGE_GetNameInternalType(Handle type)
{
	char * rc = NULL;
	PROLOG;
	SetReturnCode_cpage(IDS_ERR_NO);

	if(type != NULL)
		rc = NameData.GetItem(type);
	EPILOG;
	return rc;
}