Move: structures to anisotropy, salompl is standalone module now

This commit is contained in:
L-Nafaryus 2021-07-27 14:56:51 +05:00
parent 39db5447c9
commit cae96521b0
6 changed files with 35 additions and 37 deletions

View File

@ -1,4 +1,12 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#from anisotropy import Anisotropy
from anisotropy.anisotropy import (
Anisotropy,
logger
)
from anisotropy.simple import simple
from anisotropy.bodyCentered import bodyCentered
from anisotropy.faceCentered import faceCentered

View File

@ -225,8 +225,8 @@ class Anisotropy(object):
def getParams(structure, direction, theta):
for entry in self.params:
if entry["name"] == structure and
entry["geometry"]["direction"] == direction and
if entry["name"] == structure and \
entry["geometry"]["direction"] == direction and \
entry["geometry"]["theta"] == theta:
return entry
@ -294,11 +294,11 @@ class Anisotropy(object):
self.params = sorted(self.params, key = lambda entry: f"{ entry['name'] } { entry['geometry']['direction'] } { entry['geometry']['theta'] }")
@timer
def computeMesh(self):
scriptpath = os.path.join(env["ROOT"], "salomepl/genmesh.py")
def computeMesh(self, name, direction, theta):
scriptpath = os.path.join(self.env["ROOT"], "anisotropy/genmesh.py")
port = 2900
out, err, returncode = salomepl.runSalome(port, scriptpath, env["ROOT"], case)
out, err, returncode = salomepl.runSalome(port, scriptpath, env["ROOT"], name, direction, theta)
def computeFlow(self):
pass

View File

@ -5,9 +5,9 @@
##
import os, sys
import math
import logging
import salome
import click
@click.command()
@click.argument("root")
@ -29,18 +29,21 @@ def genmesh(root, name, direction, theta):
os.path.join(root, "env/lib/python3.9/site-packages")
])
import logging
import click
from anisotropy import Anisotropy
from salomepl.simple import simple
from salomepl.faceCentered import faceCentered
from salomepl.bodyCentered import bodyCentered
from anisotropy import (
Anisotropy,
logger,
simple,
bodyCentered,
faceCentered
)
from salomepl.geometry import getGeom
from salomepl.mesh import Mesh, Fineness, ExtrusionMethod, defaultParameters
from salomepl.mesh import (
Mesh,
Fineness,
ExtrusionMethod,
defaultParameters
)
###
# Model
@ -51,22 +54,6 @@ def genmesh(root, name, direction, theta):
p = model.getParams(name, direction, theta)
###
# Logger
##
logging.basicConfig(
level = logging.INFO,
format = model.env["logger"]["format"],
handlers = [
logging.StreamHandler(),
logging.FileHandler(
os.path.join(model.env["LOG"], model.env["logger"]["name"])
)
]
)
logger = logging.getLogger(model.env["logger"]["name"])
###
# Entry
##
@ -141,6 +128,7 @@ def genmesh(root, name, direction, theta):
mesh.Triangle(subshape, **smp)
model.updateDB()
returncode, errors = mesh.compute()
if not returncode:

View File

@ -1,9 +1,9 @@
#import salome
#salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New()
#import GEOM
#from salome.geom import geomBuilder
#geompy = geomBuilder.New()
from math import pi, sqrt
@ -284,6 +284,8 @@ def simpleHexagonalPrism(theta = 0.01, fillet = False, direction = [1, 1, 1]):
def simple(theta, fillet, direction):
#from salomepl import getGeom
if direction in [[1, 0, 0], [0, 0, 1]]:
return simpleCubic(theta, fillet, direction)