Scippy

SoPlex

Sequential object-oriented simPlex

didxset.cpp
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the class library */
4/* SoPlex --- the Sequential object-oriented simPlex. */
5/* */
6/* Copyright (c) 1996-2024 Zuse Institute Berlin (ZIB) */
7/* */
8/* Licensed under the Apache License, Version 2.0 (the "License"); */
9/* you may not use this file except in compliance with the License. */
10/* You may obtain a copy of the License at */
11/* */
12/* http://www.apache.org/licenses/LICENSE-2.0 */
13/* */
14/* Unless required by applicable law or agreed to in writing, software */
15/* distributed under the License is distributed on an "AS IS" BASIS, */
16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17/* See the License for the specific language governing permissions and */
18/* limitations under the License. */
19/* */
20/* You should have received a copy of the Apache-2.0 license */
21/* along with SoPlex; see the file LICENSE. If not email to soplex@zib.de. */
22/* */
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25#include "soplex/didxset.h"
26#include "soplex/spxalloc.h"
27
28namespace soplex
29{
30
31void DIdxSet::setMax(int newmax)
32{
33 assert(idx != nullptr);
34 assert(max() > 0);
35
36 len = (newmax < size()) ? size() : newmax;
37 len = (len < 1) ? 1 : len;
38
39 assert(len > 0);
40
42}
43
45 : IdxSet()
46{
47 len = old.size();
48 len = (len < 1) ? 1 : len;
50
52}
53
55 : IdxSet()
56{
57 len = old.size();
58 len = (len < 1) ? 1 : len;
60
62}
63
65 : IdxSet()
66{
67 len = (n < 1) ? 1 : n;
69}
70
72{
73 if(idx)
75}
76} // namespace soplex
Dynamic index set.
Definition: didxset.h:52
virtual ~DIdxSet()
destructor.
Definition: didxset.cpp:71
DIdxSet(int n=8)
default constructor. n gives the initial size of the index space.
Definition: didxset.cpp:64
void setMax(int newmax=1)
sets the maximum number of indices.
Definition: didxset.cpp:31
Set of indices.
Definition: idxset.h:66
int max() const
returns the maximal number of indices which can be stored in IdxSet.
Definition: idxset.h:138
int * idx
array of indices
Definition: idxset.h:74
int size() const
returns the number of used indices.
Definition: idxset.h:133
IdxSet & operator=(const IdxSet &set)
assignment operator.
Definition: idxset.cpp:80
int len
length of array idx
Definition: idxset.h:73
Dymnamic index set.
Everything should be within this namespace.
void spx_realloc(T &p, int n)
Change amount of allocated memory.
Definition: spxalloc.h:90
void spx_free(T &p)
Release memory.
Definition: spxalloc.h:121
void spx_alloc(T &p, int n=1)
Allocate memory.
Definition: spxalloc.h:58
Memory allocation routines.