<commit_before>// $Id: surfaceModel.C,v 1.9 2001/07/15 21:01:00 oliver Exp $

#include <BALL/MOLVIEW/FUNCTOR/surfaceModel.h>
#include <BALL/STRUCTURE/surfaceProcessor.h>

using namespace std;

namespace BALL
{

	namespace MOLVIEW
	{

		AddSurfaceModel::AddSurfaceModel()
			throw()
			: BaseModelProcessor(),
				get_composite_(true),
				start_composite_(0)
		{
		}

		AddSurfaceModel::AddSurfaceModel
			(const AddSurfaceModel& add_surface,
			 bool deep)
			throw()
			:	BaseModelProcessor(add_surface, deep),
				get_composite_(true),
				start_composite_(0)
		{
		}

		AddSurfaceModel::~AddSurfaceModel()
			throw()
		{
			#ifdef BALL_VIEW_DEBUG
				cout << "Destructing object " << (void *)this 
						 << " of class " << RTTI::getName<AddSurfaceModel>() << endl;
			#endif 

			destroy();
		}

		void AddSurfaceModel::clear()
			throw()
		{
			BaseModelProcessor::clear();
			get_composite_ = true;
			start_composite_ = 0;
		}

		void AddSurfaceModel::destroy()
			throw()
		{
		}

		bool AddSurfaceModel::start()
		{
			get_composite_ = true;
			start_composite_ = 0;
			return BaseModelProcessor::start();
		}
				
		bool AddSurfaceModel::finish()
		{
			// insert surface only if a composite exist
			if (start_composite_ != 0)
			{
				Mesh* mesh = createMesh_();

				if (mesh == 0)
				{
					throw Exception::OutOfMemory
						(__FILE__, __LINE__, sizeof(Mesh));
				}
				// create mesh
				// ...

				// get info from the start composite
				MolecularInformation molecular_information;
				start_composite_->host(molecular_information);

				mesh->PropertyManager::set(*this);
				// mesh->readMSMSFile("/KM/usr/oliver/test.surf.vert.large", "/KM/usr/oliver/test.surf.face.large");

				System* system = dynamic_cast<System*>(start_composite_);
				if (system != 0)
				{
					cerr << "number of atoms in system:" << system->countAtoms() << endl;
					SurfaceProcessor sp;
					cerr << "applying SurfaceProcessor..." << endl;
					try 
					{
						system->apply(sp);
					}
					catch (Exception::GeneralException e)
					{
						Log.error() << "SurfaceModel: caught exception while calculating molecular surface: " << e << endl;
					}
					catch (...)
					{
						Log.error() << "SurfaceModel: caught exception while calculating molecular surface" << endl;
					}
					Log.info() << "assigning surface (" << sp.getSurface().vertex.size() << " vertices, " 
										 << sp.getSurface().triangle.size() << " triangles)" << endl;
					sp.getSurface(*mesh);
					cerr << "setting mesh name..." << endl;<commit_msg>removed: debug code<commit_after>// $Id: surfaceModel.C,v 1.10 2001/08/01 01:45:50 oliver Exp $

#include <BALL/MOLVIEW/FUNCTOR/surfaceModel.h>
#include <BALL/STRUCTURE/surfaceProcessor.h>

using namespace std;

namespace BALL
{

	namespace MOLVIEW
	{

		AddSurfaceModel::AddSurfaceModel()
			throw()
			: BaseModelProcessor(),
				get_composite_(true),
				start_composite_(0)
		{
		}

		AddSurfaceModel::AddSurfaceModel
			(const AddSurfaceModel& add_surface,
			 bool deep)
			throw()
			:	BaseModelProcessor(add_surface, deep),
				get_composite_(true),
				start_composite_(0)
		{
		}

		AddSurfaceModel::~AddSurfaceModel()
			throw()
		{
			#ifdef BALL_VIEW_DEBUG
				cout << "Destructing object " << (void *)this 
						 << " of class " << RTTI::getName<AddSurfaceModel>() << endl;
			#endif 

			destroy();
		}

		void AddSurfaceModel::clear()
			throw()
		{
			BaseModelProcessor::clear();
			get_composite_ = true;
			start_composite_ = 0;
		}

		void AddSurfaceModel::destroy()
			throw()
		{
		}

		bool AddSurfaceModel::start()
		{
			get_composite_ = true;
			start_composite_ = 0;
			return BaseModelProcessor::start();
		}
				
		bool AddSurfaceModel::finish()
		{
			// insert surface only if a composite exist
			if (start_composite_ != 0)
			{
				Mesh* mesh = createMesh_();

				if (mesh == 0)
				{
					throw Exception::OutOfMemory
						(__FILE__, __LINE__, sizeof(Mesh));
				}
				// create mesh
				// ...

				// get info from the start composite
				MolecularInformation molecular_information;
				start_composite_->host(molecular_information);

				mesh->PropertyManager::set(*this);

				System* system = dynamic_cast<System*>(start_composite_);
				if (system != 0)
				{
					cerr << "number of atoms in system:" << system->countAtoms() << endl;
					SurfaceProcessor sp;
					cerr << "applying SurfaceProcessor..." << endl;
					try 
					{
						system->apply(sp);
					}
					catch (Exception::GeneralException e)
					{
						Log.error() << "SurfaceModel: caught exception while calculating molecular surface: " << e << endl;
					}
					catch (...)
					{
						Log.error() << "SurfaceModel: caught exception while calculating molecular surface" << endl;
					}
					Log.info() << "assigning surface (" << sp.getSurface().vertex.size() << " vertices, " 
										 << sp.getSurface().triangle.size() << " triangles)" << endl;
					sp.getSurface(*mesh);
					cerr << "setting mesh name..." << endl;
{'fraction_non_alphanumeric': 0.14150563607085345, 'fraction_numerical': 0.009460547504025765, 'mean_word_length': 3.0040290088638195, 'pattern_counts': {'":': 0, '<': 103, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4108222', 'n_tokens_mistral': 2065, 'n_tokens_neox': 1550, 'n_words': 329}