Commit 29d9fd41 authored by John Tourtellott's avatar John Tourtellott

Merge branch 'master' into 'pybind-compatibility'

# Conflicts:
#   ADH/AdHSurfaceWater.py
#   ADH/adhcommon.py
parents ccc32e10 f5df09d9
......@@ -16,11 +16,13 @@ import imp
import os
import sys
import smtk
if 'pybind11' == smtk.wrappingProtocol():
if smtk.wrappingProtocol() == 'pybind11':
import smtk.attribute
import smtk.io
import smtk.mesh
import smtk.model
import smtk.simulation
# so devs don't complain about pyc files in source
sys.dont_write_bytecode = True
......
......@@ -18,13 +18,13 @@ Common functions for all ADH exporters
"""
import os
import smtk
if 'pybind11' == smtk.wrappingProtocol():
import smtk.common
reload(smtk)
if smtk.wrappingProtocol() == 'pybind11':
import smtk.attribute
import smtk.model
import smtk.mesh
import smtk.io
import smtk.mesh
import smtk.model
import smtk.simulation
# Mapping from VTK's tet face ordering to ADH's tet face
# ordering. Note that it also includes the c to fortran indexing.
......@@ -150,7 +150,11 @@ def init_scope(spec):
mesh_item = att.find('mesh')
if mesh_item:
mesh_item = smtk.attribute.to_concrete(mesh_item)
if mesh_item.isEnabled() and mesh_item.numberOfValues() > 0:
if mesh_item \
and mesh_item.isEnabled() \
and mesh_item.numberOfValues() > 0 \
and mesh_item.isSet(0):
meshset = mesh_item.value(0)
#print 'meshset', meshset
scope.mesh_collection = meshset.collection()
......@@ -165,7 +169,11 @@ def init_scope(spec):
# If no mesh selected, use model's geometry
if scope.mesh_collection is None:
if model_ent_item and model_ent_item.numberOfValues() > 0:
if model_ent_item \
and model_ent_item.isEnabled() \
and model_ent_item.numberOfValues() > 0 \
and model_ent_item.isSet(0):
model_ent = model_ent_item.value(0)
scope.model = smtk.model.Model(model_ent)
print 'model', scope.model
......@@ -176,7 +184,7 @@ def init_scope(spec):
print 'mesh', scope.mesh_collection
if not scope.model:
raise Exception('ERROR: Missing model')
raise Exception('ERROR: Model not specified or not found')
elif not scope.mesh_collection:
raise Exception('ERROR: unable to obtain mesh object')
......@@ -931,8 +939,10 @@ def assign_model_entity_ids(model, dimension, property_name='id', first=1):
print 'Unrecognized dimension', dimension
return first
mask = int(celltype)
entity_list = model.entitiesMatchingFlags(mask, True)
if smtk.wrappingProtocol() == 'pybind11':
entity_list = model.entitiesMatchingFlags(int(celltype), True)
else:
entity_list = model.entitiesMatchingFlags(celltype, True)
entity_id = first
for entity in entity_list:
model.setIntegerProperty(entity, property_name, entity_id)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment