Thermal boundary conditions with STL

I am trying to apply thermal boundary conditions to an STL object. I can get this working by applying a constant temperature to the entire object, but I would like to apply the temperatures on a facet-by-facet basis rather than to the object as a whole. I’ve been using the following code. It compiles fine, but when I actually go to run the simulation, it blows up during the initialization of the lattice. I’m creating a vector of OffLatticeBoundaryCondition3D and then inserting each boundary condition in the vector. I don’t know if this is the correct way to apply boundary conditions on a facet-by-facet basis, or if anybody knows of a more elegant solution?

[code=“cpp”]
std::vector< OffLatticeBoundaryCondition3D<T,ADESCRIPTOR,Temperature> > tBoundaryCondition(numTriangles);
for (int idx = 0; idx < numTriangles; ++idx) {
triangleList[0] = triangleListOrig[idx];
TriangleSet singleTri(triangleList, DBL);
DEFscaledMesh defMeshSingle(singleTri, 0, xDirection, margin, 0);
TriangleBoundary3D boundarySingle(defMeshSingle);
VoxelizedDomain3D voxelizedDomainSingle (
boundarySingle, flowType, param.boundingBox(), borderWidth, extendedEnvelopeWidth, blockSize );
OffLatticeModel3D<T,Temperature>
tOffLatticeModel =
new GuoAdvDiffOffLatticeModel3D<T,ADESCRIPTOR> (
new TriangleFlowShape3D<T,Array<T,2> >(boundarySingle, tProfiles),
flowType);
tOffLatticeModel->setVelIsJ(velIsJ);
tBoundaryCondition[idx] =
new OffLatticeBoundaryCondition3D<T,ADESCRIPTOR,Temperature>(
tOffLatticeModel, voxelizedDomainSingle, adLattice);
tBoundaryCondition[idx]->insert();
}

Does anybody have any ideas on this issue?