⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 array.h

📁 此为地球物理中的
💻 H
字号:
// Array.h: interface for the Array class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_ARRAY_H__C2567BD8_5E8F_437B_B49C_063B15F80A9F__INCLUDED_)
#define AFX_ARRAY_H__C2567BD8_5E8F_437B_B49C_063B15F80A9F__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "math.h"
#include "afxtempl.h"

class Array: public CObject 
{ 
public:
	struct Center//聚类中心的数据结构
	{
	   int      Index; //聚类中心标号
	   CPoint   Axis;  //聚类中心坐标
	   int      *member;//所有的成员
	   int      Tol;
      public:
         Center()
		 {
			 Index=-1;
			 Axis=CPoint(0,0);
			 member=NULL;
			 Tol=0;
		 }
         Center(int mem)
		 {
             Index=-1;
			 Axis=CPoint(0,0);
			 member=new int[mem];
			 Tol=mem;
		 }
		 void * operator new[](size_t size)
		 { 
             void *p = malloc(size); 
             return (p); 
		 } 
          void operator delete[](void *p)
		  { 
             free(p); 
		  } 
		  //void* operator new(size_t size)
		 //{
           //  void *p = malloc(size); 
            // return (p); 
		  //} 
		  void* operator new(size_t sz)
		  {
             return malloc(sz);
		  }

       /*
		 Center* operator new(int totle)
		 {
             Center *p;
			 for(int i=0;i<totle;i++)
			 { 
			   p[i]=Center();
			   p[i].Index=-1;
			   p[i].Axis=CPoint(0,0);
			   p[i].member=new int[mem];
			 }
			 return p;
		 }
		 */
	};
public:
	//构造函数
	Array();
	Array(int r,int c);
	Array(const Array &m);
	virtual ~Array();
public:
    //运算符重载;
     DOUBLE& operator()(int i, int j);
     Array operator+(const Array& M);
     Array operator+(const DOUBLE& x);
     void operator+=(const Array& M);
     Array operator-(const Array& M);
     Array operator-(const DOUBLE& x);
     void operator-=(const Array& M);
     Array operator=(const Array& M);
     Array operator*(const Array& M);
     Array operator*(const DOUBLE& x);
protected:
   int nRow;
   int nCol;
public:
   double **pValue;
public:
	 int GetColSize();
     int GetRowSize();
     void GetSize(int& m,int& n);
     void SetSize(int row,int cor);

	 BOOL LoadArray();
     BOOL LoadArray(CString strPath);
     BOOL SaveArray(CString strPath,BOOL bAscii=true); 
     BOOL SaveArray();

	 void Serialize(CArchive &ar);
public:
	void freeMemory();
	void Kjunzhi(float dis);
	void reallocm(int row, int col);//将原矩阵刷新,只留下交集 
public:
    

};

#endif // !defined(AFX_ARRAY_H__C2567BD8_5E8F_437B_B49C_063B15F80A9F__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -