Esempio n. 1
0
void GridSettingsDialog::buttonBoxClicked(QAbstractButton* button) {
  switch (mUi->buttonBox->buttonRole(button)) {
    case QDialogButtonBox::AcceptRole:
      // nothing to do here
      break;

    case QDialogButtonBox::ResetRole: {
      mCurrentGrid = GridProperties();

      // update widgets
      mUi->rbtnGroup->blockSignals(true);
      mUi->cbxUnits->blockSignals(true);
      mUi->spbxInterval->blockSignals(true);
      mUi->rbtnGroup->button(static_cast<int>(mCurrentGrid.getType()))
          ->setChecked(true);
      mUi->cbxUnits->setCurrentIndex(mCurrentGrid.getUnit().getIndex());
      mUi->spbxInterval->setValue(
          mCurrentGrid.getUnit().convertToUnit(*mCurrentGrid.getInterval()));
      mUi->rbtnGroup->blockSignals(false);
      mUi->cbxUnits->blockSignals(false);
      mUi->spbxInterval->blockSignals(false);
      updateInternalRepresentation();
      break;
    }

    default:
      // restore initial settings
      mCurrentGrid = mOriginalGrid;
      break;
  }

  emit gridPropertiesChanged(mCurrentGrid);
}
Esempio n. 2
0
void main_(const ParameterType2& p2) {

	const ParameterDimType<ParameterType2, D> p = p2;

	int grid_min[D]={ };
	int grid_max[D]={ };

	//!Read Geometry and populate geometry class
	geometry::geometry<D> g;
	int num_surfaces=p.InputFiles.size();
	geometry::surface<D> *s = new geometry::surface<D> [num_surfaces];

	if (p.surface_geometry) {
		//!If surface geometries are passed, read .vtk surface geometries
		//!surface.ReadVTK(...) reads surface file/s and modifies it/them according to the user-set parameters
		std::cout << "The geometry consists of " << p.InputFiles.size() <<" input surfaces. \n";
		for(int cs=0;cs<num_surfaces;cs++) {
			msg::print_start("Read surface input file "+p.InputFiles[cs]+"...");
			s[cs].ReadVTK(p.InputFiles[num_surfaces-cs-1], p.InputScale, p.InputTransformationDirections,
					      p.InputTransformationSigns, p.change_input_parity, p.InputShift);

			for (int h = 0; h < D; ++h) {
				grid_min[h] = std::min(grid_min[h],int(std::ceil(s[cs].Min[h] / p.GridDelta - p.snap_to_boundary_eps)));
				grid_max[h] = std::max(grid_max[h],int(std::floor(s[cs].Max[h] / p.GridDelta + p.snap_to_boundary_eps)));
			}
			msg::print_done();
#ifdef VERBOSE
	std::cout << "min = " << (s[cs].Min) << "   " << "max = " << (s[cs].Max)
			<< std::endl;
	std::cout << "min = " << (s[cs].Min / p.GridDelta) << "   " << "max = "
			<< (s[cs].Max / p.GridDelta) << std::endl;
#endif
		}
	} else {
		//!If volume geometry is passed, read the volume geometry.
		//!surface.Read(...) reads a geometry file and modifies it according to the user-set parameters
		// g.Read reads a geometry file and modifies it according to the user-set parameters
		msg::print_start("Read geometry input file...");
		g.Read(p.InputFiles[0], p.InputScale, p.InputTransformationDirections,
			p.InputTransformationSigns, p.change_input_parity, p.MapMaterials,
			p.InputShift, p.IgnoreMaterials);
		{
			// output to a .vtk file the modified initial geometry
			std::ostringstream oss;
			oss << p.OutputPath << "Initial_Volume_Mesh.vtk";
			g.Write(oss.str());
		}
		for (int h = 0; h < D; ++h) {
			grid_min[h]	= std::ceil(g.Min[h] / p.GridDelta - p.snap_to_boundary_eps);
			grid_max[h] = std::floor(g.Max[h] / p.GridDelta
						+ p.snap_to_boundary_eps);
		}
#ifdef VERBOSE
	std::cout << "min = " << (g.Min) << "   " << "max = " << (g.Max)
			<< std::endl;
	std::cout << "min = " << (g.Min / p.GridDelta) << "   " << "max = "
			<< (g.Max / p.GridDelta) << std::endl;
#endif
		msg::print_done();
	}

	//!Determine boundary conditions for level set domain
	lvlset::boundary_type bnc[D];
	for (int hh = 0; hh < D; ++hh) {
		if ((p.boundary_conditions[hh].min == bnc::PERIODIC_BOUNDARY)
				&& (p.boundary_conditions[hh].max == bnc::PERIODIC_BOUNDARY)) {
			bnc[hh] = lvlset::PERIODIC_BOUNDARY;
		} else if ((p.boundary_conditions[hh].min == bnc::INFINITE_BOUNDARY)
				&& (p.boundary_conditions[hh].max == bnc::INFINITE_BOUNDARY)) {
			bnc[hh] = lvlset::INFINITE_BOUNDARY;
		} else if (p.boundary_conditions[hh].min == bnc::INFINITE_BOUNDARY) {
			bnc[hh] = lvlset::NEG_INFINITE_BOUNDARY;
		} else if (p.boundary_conditions[hh].max == bnc::INFINITE_BOUNDARY) {
			bnc[hh] = lvlset::POS_INFINITE_BOUNDARY;
		} else {
			bnc[hh] = lvlset::SYMMETRIC_BOUNDARY;
		}
	}

	//level set grid

#ifdef VERBOSE
		std::cout << "dim " << h << " min=" << grid_min[h] << " max="
				<< grid_max[h] << std::endl;
#endif
//	}

	//!Set the level set grid "GridTraitsType<D> GridProperties(grid_min, grid_max, boundary conditions, GridDelta)"
	GridTraitsType<D> GridProperties(grid_min, grid_max, bnc, p.GridDelta);

	//!Generate the grid_type with the set GridProperties
	lvlset::grid_type<GridTraitsType<D> > grid(GridProperties);

	//!Transform the input volume geometry to surfaces and interfaces "geometry::TransformGeometryToSurfaces(...)"
	msg::print_start("Extract surface and interfaces...");
	typedef std::list<geometry::surface<D> > SurfacesType;
	SurfacesType Surfaces;
	{
		std::bitset<2 * D> remove_flags;

		for (int i = 0; i < D; ++i) {
			if (p.boundary_conditions[i].min == bnc::PERIODIC_BOUNDARY
					|| p.boundary_conditions[i].min == bnc::REFLECTIVE_BOUNDARY
					|| p.boundary_conditions[i].min == bnc::EXTENDED_BOUNDARY) {
				remove_flags.set(i);
			} else {
				if (i == p.open_boundary_direction
						&& !p.is_open_boundary_negative && p.remove_bottom)
					remove_flags.set(i);
			}
			if (p.boundary_conditions[i].max == bnc::PERIODIC_BOUNDARY
					|| p.boundary_conditions[i].max == bnc::REFLECTIVE_BOUNDARY
					|| p.boundary_conditions[i].max == bnc::EXTENDED_BOUNDARY) {
				remove_flags.set(i + D);
			} else {
				if (i == p.open_boundary_direction
						&& p.is_open_boundary_negative && p.remove_bottom)
					remove_flags.set(i + D);
			}
		}

		if (p.surface_geometry) {
			for(int cs=num_surfaces-1;cs>=0;cs--) Surfaces.push_back(s[cs]);
		} else {
			std::cout << "transform to surface\n";
			geometry::TransformGeometryToSurfaces(g, Surfaces, remove_flags,
												  p.GridDelta * p.snap_to_boundary_eps, p.report_import_errors);
		}
	}
	msg::print_done();

	//Output of initial surfaces
	int SurfaceCounter = 0;
	for (typename SurfacesType::const_iterator it = Surfaces.begin(); it != Surfaces.end(); ++it) {//unsigned int i=0;i<Surfaces.size();++i) {
		std::ostringstream oss, oss2;
		oss << p.OutputPath << "Interface" << "Initial" << "_"
				<< SurfaceCounter << ".dx";
		oss2 << p.OutputPath << "Interface" << "Initial" << "_"
				<< SurfaceCounter << ".vtk";
		it->Write(oss.str());
		it->WriteVTK(oss2.str());
		++SurfaceCounter;
	}
	//Create levelsets
	//!Create the LevelSets - a list of all level set functions
	typedef std::list<lvlset::levelset<GridTraitsType<D> , LevelSetTraitsType> > LevelSetsType;
	LevelSetsType LevelSets; //list of all level set functions

	msg::print_start("Distance transformation...");

	//!Initialize each level set with "lvlset::init(...)"
	for (typename SurfacesType::const_iterator it = Surfaces.begin(); it != Surfaces.end(); ++it) {
		LevelSets.push_back(lvlset::levelset<GridTraitsType<D> , LevelSetTraitsType>(grid));
		lvlset::init(LevelSets.back(), *it, p.report_import_errors);
	}

	msg::print_done();

	msg::print_start("Add Initial Layers...");
	proc::AddLayer(LevelSets, p.AddLayer);
	msg::print_done();

	//organization of the output information by initiation of required models
	OutputInfoType output_info;

	//!Initialize the required models and call "proc::ExecuteProcess(...)"
	//!		Possible models are: ConstantRates, SimpleDeposition, SF6_O2PlasmaEtching, SiO2_PlasmaEtching,
	//!		HBr_O2PlasmaEtching, NonlinearDeposition, WetEtching, FIB, CalculateFlux, Planarization, Mask,
	//!		and BooleanOperation
	for (typename std::list<typename ParameterType2::ProcessParameterType>::const_iterator
			pIter = p.ProcessParameters.begin(); pIter
			!= p.ProcessParameters.end(); ++pIter) {
		{
			std::ostringstream oss;
			oss << "Start execution of process \"" + pIter->ModelName + "\""
					<< std::endl << "(processing time = " << pIter->ProcessTime
					<< ")";
			msg::print_message(oss.str());
		}
		output_info.end_time += pIter->ProcessTime;
		std::cout << "AddLayer = " << pIter->AddLayer << "\n";
		proc::AddLayer(LevelSets, pIter->AddLayer);

#ifdef PROCESS_CONSTANT_RATES
		if (pIter->ModelName == "ConstantRates") {
			model::ConstantRates m(pIter->ModelParameters, pIter->MaskLayer);
			proc::ExecuteProcess(LevelSets, m, p, *pIter, output_info);
		}
#endif

#ifdef PROCESS_SIMPLE_DEPOSITION
		if (pIter->ModelName == "SimpleDeposition") {
			model::SimpleDeposition m(pIter->ModelParameters);
			proc::ExecuteProcess(LevelSets, m, p, *pIter, output_info);
		}
#endif

#ifdef PROCESS_SF6_O2_PLASMA_ETCHING
		if (pIter->ModelName == "SF6_O2PlasmaEtching") {
			model::SF6_O2PlasmaEtching m(pIter->ModelParameters);
			proc::ExecuteProcess(LevelSets, m, p, *pIter, output_info);
		}
#endif

#ifdef PROCESS_SiO2_PLASMA_ETCHING
		if (pIter->ModelName == "SiO2_PlasmaEtching") {
			model::SiO2_PlasmaEtching m(pIter->ModelParameters);
			proc::ExecuteProcess(LevelSets, m, p, *pIter, output_info);
		}
#endif

#ifdef PROCESS_HBr_O2_PLASMA_ETCHING
		if (pIter->ModelName == "HBr_O2PlasmaEtching") {
			model::HBr_O2PlasmaEtching m(pIter->ModelParameters);
			proc::ExecuteProcess(LevelSets, m, p, *pIter, output_info);
		}
#endif

#ifdef PROCESS_CFx_DEPOSITION
		if (pIter->ModelName == "CFx_Deposition") {
			model::CFx_Deposition m(pIter->ModelParameters);
			proc::ExecuteProcess(LevelSets, m, p, *pIter, output_info);
		}
#endif

#ifdef PROCESS_NONLINEAR_DEPOSITION
		if (pIter->ModelName == "NonlinearDeposition") {
			model::NonlinearDeposition m(pIter->ModelParameters);
			proc::ExecuteProcess(LevelSets, m, p, *pIter, output_info);
		}
#endif

#ifdef PROCESS_WET_ETCHING
		if (pIter->ModelName == "WetEtching") {
			model::WetEtching m(pIter->ModelParameters);
			proc::ExecuteProcess(LevelSets, m, p, *pIter, output_info);
		}
#endif

#ifdef PROCESS_FIB
		if (pIter->ModelName == "FIB") {
			model::FIB m(pIter->ModelParameters);
			proc::ExecuteProcess(LevelSets, m, p, *pIter, output_info);
		}
#endif

#ifdef PROCESS_CALCULATEFLUX
		if (pIter->ModelName == "CalculateFlux") {
			model::CalculateFlux m(pIter->ModelParameters);
			proc::ExecuteProcess(LevelSets, m, p, *pIter, output_info);
		}
#endif

#ifdef PROCESS_PLANARIZATION
    if (pIter->ModelName=="Planarization") {
        model::Planarization m(pIter->ModelParameters);
        proc::ExecuteProcess(LevelSets, m, p, *pIter,output_info);
    }
#endif

#ifdef PROCESS_MASK
    if (pIter->ModelName=="Mask") {
        model::Mask m(pIter->ModelParameters);
        proc::ExecuteProcess(LevelSets, m, p, *pIter,output_info);
    }
#endif

#ifdef PROCESS_BOOLEANOPS
    if (pIter->ModelName=="BooleanOperation") {
        model::BooleanOps m(pIter->ModelParameters);
        proc::ExecuteProcess(LevelSets, m, p, *pIter,output_info);
    }
#endif

		output_info.start_time = output_info.end_time;
		output_info.process_counter++;
	}
	delete [] s;
}