コード例 #1
0
ファイル: Mpi.py プロジェクト: guillaume-florent/cassiopee-ce
def extractMesh(t,
                extractionMesh,
                order=2,
                extrapOrder=1,
                constraint=40.,
                tol=1.e-6,
                mode='robust',
                hook=None,
                graph=None):
    if graph is None:
        tb = Cmpi.createBBoxTree(t)
        tb2 = Cmpi.createBBoxTree(extractionMesh)
        graph = Cmpi.computeGraph(tb, type='bbox3', t2=tb2)
    tl = Cmpi.addXZones(t, graph)
    tl = Cmpi.convert2PartialTree(tl)
    ext = Cmpi.convert2PartialTree(extractionMesh)
    # print info
    zones = Internal.getZones(tl)
    print('Rank %d has %d source zones.' % (Cmpi.rank, len(zones)))
    ext = P.extractMesh(tl,
                        ext,
                        order=order,
                        extrapOrder=extrapOrder,
                        constraint=constraint,
                        tol=tol,
                        mode=mode,
                        hook=hook)
    return ext
コード例 #2
0
def optimizeOverlap(t, double_wall=0, priorities=[], graph=None,
                    intersectionsDict=None):
    if graph is None:
        tb = Cmpi.createBBoxTree(t)
        graph = Cmpi.computeGraph(tb, type='bbox2',
                                  intersectionsDict=intersectionsDict)
    tl = Cmpi.addXZones(t, graph)
    tl = Cmpi.convert2PartialTree(tl)
    # print info
    zones = Internal.getZones(tl)
    #print 'Rank %d has %d zones.'%(Cmpi.rank, len(zones))
    tl = X.optimizeOverlap(tl, double_wall, priorities, intersectionsDict)
    tl = Cmpi.rmXZones(tl)
    return tl
コード例 #3
0
# - computeGraph (pyTree) -
import Converter.PyTree as C
import Converter.Mpi as Cmpi
import Distributor2.PyTree as Distributor2
import Generator.PyTree as G
import Connector.PyTree as X
import KCore.test as test

# Through BBox
a = G.cart((0, 0, 0), (1, 1, 1), (10, 10, 10))
b = G.cart((8, 0, 0), (1, 1, 1), (10, 10, 10))
t = C.newPyTree(['Base', a, b])
(t, dic) = Distributor2.distribute(t, NProc=2, algorithm='fast')
tb = Cmpi.createBBoxTree(t)
graph = Cmpi.computeGraph(tb, type='bbox')
if Cmpi.rank == 0: test.testO(graph, 1)

# Through match
a = G.cart((0, 0, 0), (1, 1, 1), (10, 10, 10))
b = G.cart((9, 0, 0), (1, 1, 1), (10, 10, 10))
t = C.newPyTree(['Base'])
t[2][1][2] += [a, b]
t = X.connectMatch(t)
(t, dic) = Distributor2.distribute(t, NProc=2, algorithm='fast')
graph = Cmpi.computeGraph(t, type='match')
if Cmpi.rank == 0:
    test.testO(graph, 2)