source: issm/trunk-jpl/src/c/classes/Params/IntMatParam.cpp@ 16233

Last change on this file since 16233 was 16233, checked in by Mathieu Morlighem, 11 years ago

DEL: removed legacy code

File size: 2.4 KB
Line 
1/*!\file IntMatParam.c
2 * \brief: implementation of the IntMatParam object
3 */
4
5/*header files: */
6/*{{{*/
7#ifdef HAVE_CONFIG_H
8 #include <config.h>
9#else
10#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
11#endif
12
13#include "../classes.h"
14#include "shared/shared.h"
15/*}}}*/
16
17/*IntMatParam constructors and destructor*/
18/*FUNCTION IntMatParam::IntMatParam(){{{*/
19IntMatParam::IntMatParam(){
20 return;
21}
22/*}}}*/
23/*FUNCTION IntMatParam::IntMatParam(int enum_type,IssmIntMat value){{{*/
24IntMatParam::IntMatParam(int in_enum_type,int* in_value, int in_M,int in_N){
25
26 enum_type=in_enum_type;
27 M=in_M;
28 N=in_N;
29
30 value=xNew<int>(M*N);
31 xMemCpy<int>(value,in_value,M*N);
32}
33/*}}}*/
34/*FUNCTION IntMatParam::~IntMatParam(){{{*/
35IntMatParam::~IntMatParam(){
36 xDelete<int>(value);
37 return;
38}
39/*}}}*/
40
41/*Object virtual functions definitions:*/
42/*FUNCTION IntMatParam::Echo {{{*/
43void IntMatParam::Echo(void){
44
45 _printf_("IntMatParam:\n");
46 _printf_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
47 _printf_(" matrix size: " << this->M << "x" << this->N << "\n");
48
49}
50/*}}}*/
51/*FUNCTION IntMatParam::DeepEcho{{{*/
52void IntMatParam::DeepEcho(void){
53
54 int i,j;
55
56 _printf_("IntMatParam:\n");
57 _printf_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
58 _printf_(" matrix size: " << this->M << "x" << this->N << "\n");
59 for(i=0;i<this->M;i++){
60 for(j=0;j<this->N;j++){
61 _printf_("(" << i << "," << j << ") " << *(this->value+N*i+j) << "\n");
62 }
63 }
64}
65/*}}}*/
66/*FUNCTION IntMatParam::Id{{{*/
67int IntMatParam::Id(void){ return -1; }
68/*}}}*/
69/*FUNCTION IntMatParam::ObjectEnum{{{*/
70int IntMatParam::ObjectEnum(void){
71
72 return IntMatParamEnum;
73
74}
75/*}}}*/
76/*FUNCTION IntMatParam::copy{{{*/
77Object* IntMatParam::copy() {
78
79 return new IntMatParam(this->enum_type,this->value,this->M,this->N);
80
81}
82/*}}}*/
83
84/*IntMatParam virtual functions definitions: */
85/*FUNCTION IntMatParam::GetParameterValue{{{*/
86void IntMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){
87 int* output=NULL;
88
89 output=xNew<int>(M*N);
90 xMemCpy<int>(output,value,M*N);
91
92 /*Assign output pointers:*/
93 if(pM) *pM=M;
94 if(pN) *pN=N;
95 *pintarray=output;
96}
97/*}}}*/
98/*FUNCTION IntMatParam::SetValue{{{*/
99void IntMatParam::SetValue(int* intarray,int in_M,int in_N){
100
101 /*avoid leak: */
102 xDelete<int>(this->value);
103
104 this->value=xNew<int>(in_M*in_N);
105 xMemCpy<int>(this->value,intarray,in_M*in_N);
106
107 this->M=in_M;
108 this->N=in_N;
109}
110/*}}}*/
Note: See TracBrowser for help on using the repository browser.