Skip to content

Reply To: adding more cylinders in Cylinder3D

#8884

Thank you for the suggestion. I am provoding a code snippet below. Is this the way I need to implement it? Is it correct? Please reply,

void prepareGeometry(UnitConverter<T, DESCRIPTOR> const& converter, IndicatorF3D<T>& indicator,
STLreader<T>& stlReader, SuperGeometry<T, 3>& superGeometry)
{
// … (existing code)

// Set material number for additional cylinders
origin[0] = superGeometry.getStatistics().getMinPhysR(2)[0] + 2 * converter.getConversionFactorLength();
extend[0] = (superGeometry.getStatistics().getMaxPhysR(2)[0] – superGeometry.getStatistics().getMinPhysR(2)[0]) / 2.;

// Create additional cylinder indicators
std::shared_ptr<IndicatorF3D<T>> cylinder2 = std::make_shared<IndicatorCuboid3D<T>>(extend, origin);
superGeometry.rename(2, 6, cylinder2); // Material number 6

std::shared_ptr<IndicatorF3D<T>> cylinder3 = std::make_shared<IndicatorCuboid3D<T>>(extend, origin);
superGeometry.rename(2, 7, cylinder3); // Material number 7

// Removes all not needed boundary voxels outside the surface
superGeometry.clean();
superGeometry.checkForErrors();

superGeometry.print();

clout << “Prepare Geometry … OK” << std::endl;
}